itinance / itinance/react-native-fs

RNFS.downloadFile not working on Android

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

Description

I am having an issue where RNFS.downloadFIle will not work on Android, no crash or error, the app reaches this line `RNFS.downloadFile(options).promise.then(response => {` and never enters the block, not sure whats going on since no error message and this works fine on iOS.

Oddly this seems to work on **some** android emulators but not my devices i've tested such as galaxy s7 or s8.

react-native-fs 2.11.15

This is my full code block:

`const fromPath = url
const toPath = `${RNFS.DocumentDirectoryPath}/${tempArray[i].Image}`
const options = {
fromUrl: fromPath,
toFile: toPath,
background: true,
progressDivider: 10,
}
RNFS.exists(toPath).then(response => {
if (!response) {
RNFS.downloadFile(options).promise.then(response => {
if (response.statusCode !== 200) {
if (failedDownloads.indexOf(tempArray[i].Image) <= -1) {
failedDownloads.push(tempArray[i].Image)
}
throw response
}
}).catch(err => err)
}
})`

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.