How to copy image file from one folder to another?
ghulamabbas2 opened this issue · 1 comments
ghulamabbas2 commented
I have written this code:
ScopedStorage.copyFile(item.uri, dir.uri)
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
The app crashes when I click on the button to copy the file. Can anyone provide me the correct way to copy file?
ammarahm-ed commented
@ghulamabbas2 First create the file you want to copy using ScopedStorage.createFile
then use the returned url in copyfile to write it's contents.
const file = await ScopedStorage.createFile(...);
ScopedStorage.copyFile(item.uri, file.uri)
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});