Capacitor 3 open or download file

0

I am struggling with something I thought will be simple.

Ideally I want to save my base64 file with prompt same as you get when downloading from browser, however that seems impossible with capacitor app.

So I used FileSystem, to save file on Documents directory, which went fine, I also can get uri file. But because there is no indicator that file was saved, I would like to at least try to open the file with native apps. I’ve noticed there is cordova plugin cordova-plugin-file-opener2 but I can’t seem to make it work with capacitor 3 and VueJs, without cordova.

Maybe I am overthinking it ? is there any way download file or open file with Capacitor?

For web view (not native app) I am using hidden download button, but that does not work at all in capacitor app

here is my current code

Filesystem.writeFile({
    data: pdf,
    path: `${this.fileName}.pdf`,
    directory: Directory.Documents,
 }).then(() => {
    Filesystem.getUri({
    path: `${this.fileName}.pdf`,
    directory: Directory.Documents,
 }).then(res => {
  // open file here with my res.uri ?
  );
});

I did use FileOpener2 in a Capacitor 3 App (Angular). What problem do you have with it?

Actually as we speak I’ve managed to used it :wink: and yes it’s working, now I will have a go with Downloader plugin

May i know which plugin have u used for downloading . i tried using file transfer and facing issues with that

Currently I am using Filesystem and @ionic-native/file-opener but it’s not the best solution and doesn’t work on all devices.
For Web I am using file-saver