itinance / itinance/react-native-fs

IOS file downloaded not able to be located on device

Open
#897 18 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hi there

Using a standard implementation to download files and save them locally on the device.
When they are downloaded, I am not able to locate them on the device with for example "File Explorer" app, tried on emulator and physical iPad.

```js
const urlExtensions = this.getUrlExtension(attachment.url);
const localFile = `${RNFS.LibraryDirectoryPath}/${attachment.title}.${urlExtensions}`;

const options = {
fromUrl: attachment.url,
toFile: localFile,
fileCache: true
};

if (await RNFS.exists(localFile)) {
FileViewer.open(localFile);
} else {
await RNFS.downloadFile(options).promise
.then(() => {
FileViewer.open(localFile);
})
.then((res) => {
// success
// console.log("success");
})
.catch(error => {
// error
console.log("Attachment open error: ", error);
});
}
```

Also tried to use "DocumentDirectoryPath", same issue.

Thanks in advance

Regards

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.