I am trying to find the actual paths on device for files when writing them with the Capacitor File Plugin?
The code I am using is directly from the sample, but the documentation is not as detailed as the old cordova-file-plugin.
So what does “/EXTERNAL_STORAGE” translate to on device
const testFileWrite = async () => {
try {
const result = await Filesystem.writeFile({
path: 'secrets/text.txt',
data: "This is a test",
directory: FilesystemDirectory.ExternalStorage,
encoding: FilesystemEncoding.UTF8
})
let stat = await Filesystem.stat({directory: FilesystemDirectory.ExternalStorage, path:'secrets/text.txt'})
let l = await Filesystem.getUri( {directory: FilesystemDirectory.ExternalStorage, path:'secrets/text.txt'});
console.log('file uri', Capacitor.convertFileSrc(l.uri));
console.log('stat', stat);
console.log('Wrote file', result);
} catch(e) {
console.error('Unable to write file', e);
}
try {
let ret = await Filesystem.readdir({
path: 'secrets',
directory: FilesystemDirectory.ExternalStorage
});
console.log(JSON.stringify(ret.files));
} catch(e) {
console.error('Unable to read dir', e);
}
}