Created
August 23, 2013 19:25
-
-
Save macdonst/6323034 to your computer and use it in GitHub Desktop.
Working download gist.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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