I'm using the file-transfer
cordova plugin to download files and InAppBrowser
to view remote ones, but I'm not able to:
-
Save the file to the correct location (as in the main menu screen on iOS) using
file-transfer
let targetPath = cordova.file.syncedDataDirectory + file; fileTransfer.download(fileLocation, targetPath, (res) => { // manipulate the file etc }
syncedDataDirectory
is obviously the wrong path, but documentsDirectory
doesn't store the file anywhere useful for the user either. The files are saving but I need them in a place the user can open them up in iBooks etc.
-
Display a local file in InAppBrowser (something to do with safari sandboxing my files?)
this.platform.ready().then(() => { cordova.InAppBrowser.open(url, "_system", "location=true"); });
Safari will simply not let me display local files. Surely there must be a way?
I don't mind which one (although i'd like to know what users would prefer themselves), I just want to find a solution for either.