At its simplest level, I have this code. (In an ionic 3 app, running ionic native 4.2.2, emulating using android studio)
return this.file.readAsArrayBuffer(url, fileName)
.then((file) => {
console.log("HEY. WE FOUND THE FILE")
return file
})
.catch((err) => {
console.log("ERROR IN genFile")
console.log(err.message)
}).then((res)=>{
return new Blob([res])
})
File is the import from ‘@ionic-native/file’;
Now, whenever this code executes, even when I manually pass in a url i know to be valid (confirmed its existence with checkFile), the code throws an error, namely: “Wrong type for parameter “path” of DirectoryEntry.getFile: Expected String, but got Array.” According to the docs, both parameters should be strings, and indeed, they are, (this happens when i hardcode the parameters to be strings). I dove into the cordova code, and indeed, there’s a function in DirectoryEntry called getFile.
Now, I believe I’m doing everything alright and this might be a bug, but searching the internet has revealed exactly no-one with this problem, so I thought i’d ask and see if anyone has encountered this before, and how they’ve tried to resolve it.