Filesystem plugin allows to use absolute file urls, or relative if you pass the directory.
If you don’t pass the directory and use the absolute file url it might work depending on the path, it’s possible to read/write on the paths that “belong” to your app, and some other public “shared” folders.
But those public “shared” folders are no longer available on Android 10 unless you enable the legacy filesystem, and no longer available on Android 11+ even if you enabled the legacy filesystem.
On Android 11+, might be possible to write everywhere if you add (and request) the MANAGE_EXTERNAL_STORAGE
permission, which Filesystem plugin doesn’t request.
All the above is just for Android, on iOS there are no public shared folder you can write to, you can only read/write inside your app sandbox. I think in Capacitor 2 the file urls won’t work on iOS, but they will in Capacitor 3 with @capacitor/filesystem plugin.
Your code is probably not working because you have used file://
, while the path should start with file:///