I've been using rn-fetch-blob for my project so far but had some issues with it and would like to replace it with react-native-blob-util.
however, the latter implements media storage witch (to my understanding) changes paths from for ex: /storage/emulated/0/Download/ to /storage/emulated/0/Android/data/<package_name>/files/Download/ on newer android versions.
but when I did some digging on the library source code I found a property called LegacyDownloadDir and also in the release notes for the version 0.16.2 it said such properties do exist, but I can't find them.
I tried calling:
ReactNativeBlobUtil.fs.dirs.LegacyDownloadDirbut it returns undefined and Typescript can't seem to find it.
am I calling it the wrong way? or do I need to configure something before it shows up.
Thank you.
3 Answers
No you're calling it correctly. Seems like a bug ()
Which Android version and device are you using?
I will take a look at it and see if there is a fix required.
1I fixed the problems yesterday in 0.16.3
2I'm on android 12. For now I'm using react-native-fs for android and calling RNFS.DownloadDirectoryPath which seems to give me the path to the general download directory.
For iOS it seems to require more steps. I first have to use react-native-document-picker and call DocumentPicker.pickDirectory() to let the user pick where they want to store the document, then use the resulting path to write the file RNFS.writeFile(path, file, "base64")