HI,
I am using FileOpener plugin in order to open a based64 file converted to Blob.
The file is being created succesffuly in the download folder, but file opener fails to open it/
Error:
TypeError: Object(…) is not a function
at FileOpener.open (vendor.js:101647) at 8.js:323 at t.invoke (polyfills.js:3) at Object.onInvoke (vendor.js:4982) at t.invoke (polyfills.js:3) at r.run (polyfills.js:3) at polyfills.js:3 at t.invokeTask (polyfills.js:3) at Object.onInvokeTask (vendor.js:4973) at t.invokeTask (polyfills.js:3)
MY code:
let filename = "temp.pdf";
this.file.writeFile(this.file.externalRootDirectory + '/Download/', filename, this.convertBaseb64ToBlob(data.file, 'application/pdf'), {replace: true})
.then((fileEntry: FileEntry) => {
console.log("File created!");
debugger;
let test = fileEntry.toURL();
//Open with File Opener plugin
this.fileOpener.open(test, 'application/pdf')
.then(() => {
console.log('File is opened');
loading.dismiss();}
).
catch(err => {
debugger;
console.error('Error openening file: ' + err);
loading.dismiss();}
);
})
.catch(function(err) {
debugger;
console.log(err);
loading.dismiss();
});
THanks!