Skip to content

Instantly share code, notes, and snippets.

@shazron
Created February 11, 2013 23:47
Show Gist options
  • Select an option

  • Save shazron/4758724 to your computer and use it in GitHub Desktop.

Select an option

Save shazron/4758724 to your computer and use it in GitHub Desktop.
Get a FileEntry
function getFileEntry(localFileSystem, filePath, onGetFileWin, onGetFileFail)
{
var onFSWin = function(fileSystem) {
fileSystem.root.getFile(filePath, {create: true, exclusive: false}, onGetFileWin, onGetFileFail);
}
var onFSFail = function(evt) {
console.log(evt.target.error.code);
}
window.requestFileSystem(localFileSystem, 0, onFSWin, onFSFail);
}
var onGetFileWin = function(entry) {
// TODO: do something with the FileEntry entry
}
var onGetFileFail = function() {
console.log("error getting file")
}
getFileEntry(LocalFileSystem.PERSISTENT, "MyApp/myfile.txt", onGetFileWin, onGetFileFail);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment