Hi,
I'm trying to do a simple downloadFile operation with react-native-fs on iOS simulator, e.g.
import fs from 'react-native-fs';
fs.downloadFile({
fromUrl: 'http://www.domain.com/database.db',
toFile: fs.DocumentDirectoryPath + '/database.db'
})
.promise.then((res) => {
fs.exists('database.db').then((exists) => {
// File was downloaded
});
})
.catch((error) => {
console.log(error);
});
I've tried with and without specifying DocumentDirectoryPath, however the catch always fires, and error contains:
ReferenceError: e is not defined
at FS.common.js:487
at tryCallOne (core.js:37)
at core.js:123
at JSTimers.js:301
at _callTimer (JSTimers.js:154)
at _callImmediatesPass (JSTimers.js:202)
at Object.callImmediates (JSTimers.js:470)
at MessageQueue.__callImmediates (MessageQueue.js:329)
at MessageQueue.js:147
at MessageQueue.__guardSafe (MessageQueue.js:316)
If I click FS.common.js it shows this block of code
.catch(() => {
return Promise.reject(e);
})
I have added my domain to App Transport Security in case it was that, I don't have any build errors, the 'exists' method seems to work fine.
"react": "16.2.0",
"react-native": "0.52.2"
"react-native-fs": "^2.9.9"
Installed fs using Podfile all OK.
Any thoughts ? Feels like I'm missing something obvious
seems editing FS.common.js and changing it to .catch((e) fixed it which then led to an error about App Transport Security, so I know what to fix now. Looks like a small glitch that needs fixing
I am facing the same problem. Did you fixed it ?
it worked. thank you very much. I wonder how do you people find these solutions.
Thanks for reporting the issue! I fixed the catch-handler and just published 2.9.10!
Greast, thanks!
i am going to close this one now. Feel free at any time to reopen if it still persists for you
Most helpful comment
seems editing FS.common.js and changing it to
.catch((e)fixed it which then led to an error about App Transport Security, so I know what to fix now. Looks like a small glitch that needs fixing