I am using the react-native-fs module, however my app seems to be freezing on it. I have the following piece of code in one of my React-Native methods:
console.log("One")
await RNFS.downloadFile({
fromUrl: 'http://example.com/data/blah.zip',
toFile: RNFS.DocumentDirectoryPath + "/userdata/blah.zip",
}).promise
console.log("Two")
"One" is echoed to the console, but "Two" never gets echoed. There is no error thrown. The URL does in fact exist and the RNFS.DocumentDirectoryPath + /userdata directory does exist.
What am I doing wrong? Why is no error thrown? Why is it hanging at this point?
Update
Unfortunately, because it only seems to happen sometimes it is hard to diagnose or to produce a smaller test. What I've had to do is when this happens I have to shut down the react-native command prompt node window and rerun react-native run-android
. Once I do that it proceeds perfectly.