itinance / itinance/react-native-fs
How to Downloadfile to /Storage/ folder
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
` no such file or directory, open '/storage/emulated/0/Download/a.mp4'`
### React-native info
System:
OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
Memory: 689.81 MB / 15.53 GB
Shell: 5.0.16 - /bin/bash
Binaries:
Node: 10.16.2 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
SDKs:
Android SDK:
API Levels: 22, 23, 24, 25, 26, 27, 28, 29
Build Tools: 26.0.2, 28.0.3, 29.0.2
System Images: android-22 | Intel x86 Atom, android-23 | Intel x86 Atom, android-25 | Google APIs ARM 64 v8a, android-27 | Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5
npmGlobalPackages:
react-native-cli: 2.0.1
### Mycode
```javascript
const downloadDest = `/storage/emulated/0/Download`;
const options = {
// fromUrl: videoPath,
fromUrl: "http://vfx.mtime.cn/Video/2019/03/19/mp4/190319222227698228.mp4",
toFile: `${downloadDest}/a.mp4`,
progressDivider: 1,
begin: (res) => {
console.warn('begin download', res);
},
progress: (res) => {
console.warn('download progress', res);
this.setState({
progress:res
})
}
};
console.warn(options);
const ret = RNFS.downloadFile(options);//调用downloadFile开始下载
ret.promise.then(res => {
ZkToast.info("下载完成");
})
.catch(err => {
console.warn(err)
ZkToast.info("下载出错时执行")
})
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.