Hello! I'm facing a difficult in use the lib. I'm trying to use the downloadFile and not return any errors and isn't working. This is my code:
RNFS.downloadFile({
fromUrl: 'https://facebook.github.io/react-native/img/header_logo.png',
toFile: `${RNFS.DocumentDirectoryPath}/react-native.png`,
}).promise.then((res) => {
RNFS.exists('react-native.png').then((exists) => {
console.log('exists');
});
}).catch(() => {
return Promise.reject(e);
});
Someone to help me please.
I have the same issue, download file on android does nothing but works correct on IOS.
download = async (target, destination) => {
try{
let options = {
fromUrl: target,
toFile: destination,
begin: (res) => {
console.log(res)
},
progress: (data) => {
console.log(data)
},
background: true,
progressDivider: 1
}
console.log(options)
const request = await RNFS.downloadFile(options).promise
console.log(request)
}catch(e){
console.log(e)
}
}
I only get 1 console log which is options before the await, it does not time out or error.
I upgraded to react-native-fs 2.10.14 and it fixed it
Upgrading did not resolve this issue for me, happens only on Android devices.
I worked on version 2.9.12 in Android an IOS.
Funny, it was working for me without at first but then it stopped. This also fixed it for me.
Most helpful comment
I have the same issue, download file on android does nothing but works correct on IOS.
I only get 1 console log which is options before the await, it does not time out or error.