Downloading files to local device ionic react

Hello

I have a requirement where I have doc/pdf/xls/jpeg/png files saved in the backend. I have a backend path where the files are retrieved as a blob.

Now, as a requirement I want to download the file to the local storage of the device. As a usecase I want that the downloaded file can be viewed using native apps like adobe, ms office etc. The same usecase as downloading an attachment and viewing from gmail.

I cannot find a good alternative for this in native mode. The capacitor Filesystem seem to only save in application specific storage and not accessible outside it, eg: from gallery

I did find a few posts which suggest using ‘@awesome-cordova-plugins/http/ngx’. This looks to be an Angular specific package. I am using Ionic React.

I have this code working for web mode

    let url = window.URL.createObjectURL(res.data);
    let a = document.createElement("a");
    document.body.appendChild(a);
    a.href = url;
    a.download = res.filename;
    a.click();
    window.URL.revokeObjectURL(url);

Any help is greatly appreciated.

Regards