Provide user feedback when @capacitor/filesystem has finished writing

Hi, I’m building this native app with capacitor and it’s actually my first time ever touching ionic, so bear with me if I write the obvious.

I need to download a PDF file and save it on the user’s phone. I used the filesystem plugin to achieve this and it’s actually working. The problem is that, when it has finished writing, it gives absolutely no feedback. Right now I check for the uri existence in the result and show a modal, but, if I didn’t know where to look the file in, I would guess the download didn’t work.

Usually when I download something through an app, android (I only have this, but I guess also iOS) shows me file confirmation dialogs and notifies me when the it has finished writing with a notification that points directly to the downloaded file, so that I don’t have to look it up with a file manager. I couldn’t find any option on the docs, any info online and it actually looks no one ever posed the problem in the first place.

I was also looking into opening the file automatically when the writing process has finished, but I only found the cordova plugin for @ionic-native/file-opener, which I can’t install for a version mismatch with rxjs.

Do you have any idea on how to let someone that doesn’t even know what a file manager is, know that the file has been downloaded and to allow him to open it?

If you are using @capacitor/filesystem and writeFile method, it returns a promise that resolves when the file is written, and also provides the native file path. So you can use the promise syntax with .then, or use an await like this:

const file = await Filesystem.writeFile({
    path: 'secrets/text.txt',
    data: "This is a test",
    directory: Directory.Documents,
    encoding: Encoding.UTF8,

The console.log won’t be executed until the file is written, replace that with a plugin call to open the file.