I am using Cordova FileTransfer object to download a file from a url to device.
var fileTransfer = new FileTransfer();
var path = cordova.file.dataDirectory
In Cordova, with FileTransfer
, you can request TEMPORARY
or PERSISTENT
file system
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail);
- iOS
PERSISTENT
will return the Documents directory,TEMPORARY
will return the Caches directory- Android
PERSISTENT
will returns the root of the SD card/phone memoryTEMPORARY
will return a folder inside the data folder.
Refer File API & FileTransfer for more info.