You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, after writing a file, you have to use Filesystem.getUri to retrieve the newly created file URI. Could the writeFile function return the URI, which would save a step?
dotNetkow
changed the title
[Filesystem Plugin] writeFile should return file URI
[Filesystem Plugin] writeFile should return file URI and webpath URI
Jul 22, 2019
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Currently, after writing a file, you have to use
Filesystem.getUri
to retrieve the newly created file URI. Could thewriteFile
function return the URI, which would save a step?Current:
`
await Filesystem.writeFile({
path: new Date().getTime() + '.jpeg',
data: readFile.data,
directory: FilesystemDirectory.Data
});
`
Proposed:
const newFile = await Filesystem.writeFile({
path: new Date().getTime() + '.jpeg',
data: readFile.data,
directory: FilesystemDirectory.Data
});
const uri = newFile.uri;
Additionally, returning the webpath URI from
writeFile
would be great, too - so the user doesn't have to convert using this:const webPathUri = Capacitor.convertFileSrc(newFile);
The text was updated successfully, but these errors were encountered: