Skip to content

Instantly share code, notes, and snippets.

@macdonst
Created August 23, 2013 19:25
Show Gist options
  • Save macdonst/6323034 to your computer and use it in GitHub Desktop.
Save macdonst/6323034 to your computer and use it in GitHub Desktop.
Working download gist.
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function(fileSystem) {
fileSystem.root.getFile("localFileName.txt", {create: true, exclusive: false}, function(fileEntry) {
var localPath = fileEntry.fullPath;
if (device.platform === "Android" && localPath.indexOf("file://") === 0) {
localPath = localPath.substring(7);
}
var ft = new FileTransfer();
ft.download("https://dl.dropboxusercontent.com/u/887989/guinness.jpg", localPath, function(entry) {
console.log("successful download");
}, failFn);
}, failFn);
}, failFn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment