itinance / react-native-fs

Native filesystem access for react-native
MIT License
4.95k stars 978 forks source link

Android RNFS.downloadFile only store file to root access directory #567

Open adamnator92 opened 6 years ago

adamnator92 commented 6 years ago

Environment

react: ^16.3.1 react-native: ^0.56.0 react-native-fs: ^2.11.18

Current behaviour

on android set the download file path toRNFS.DocumentDirectoryPath, but unfortunately it will only store to android root access directory /data/user/0/com.[appname]/files.

const ret = RNFS.downloadFile({
    fromUrl: url,
    toFile: RNFS.DocumentDirectoryPath + file.jpg,
});

any way i can save the downloaded file to public directory allow user to access from gallery?

likfe commented 5 years ago

The following constants are available on the RNFS export:

on Android ,you can choose ExternalDirectoryPath or ExternalStorageDirectoryPath

wangfpp commented 4 years ago

How to download file to /storage/emulated/