itinance / itinance/react-native-fs

Download file on iOS

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

Description

I use react-native-fs to download file in iOS. I check on simulator it's download success with path:

_/Users/admin/Library/Developer/CoreSimulator/Devices/443C8F7F-AB92-4217-A999-A7BDBA52A6B6/data/Containers/Data/Application/99958A5C-E350-4855-B8CE-ED6FA999C619/Documents._

On real device, it's path (iPhone 8 Plus White 64Gb):

_/var/mobile/Containers/Data/Application/63F84623-E684-456F-A55A-01E22708C012/Documents/pexels-photo-1109561.jpeg_

I try set: _const destPath = RNFS.DocumentDirectoryPath + '/images/' + name;_

but it't not work. I want to this image display on photo, this mean after download success i can see it on my photo immediately, how can do that and what about the others file like: mp3, mp4, text, after download, how to find it's and show for user when they want to read?

This is my code:

```
downloadFile1 = (url, name) => {
const destPath = RNFS.DocumentDirectoryPath + '/images/' + name;
let option = {
fromUrl: url,
toFile: destPath
};
RNFS.downloadFile(option).promise.then(res => {
console.log('res -----------------------------> ', res);
});
};
```

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.