Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the file system in react native?

I'm developing a file storage app that needs to read the contents of the sd-storage and internal phone storage. I've checked out react-native-fs and react-native-fetch-blob but both of these apps only allow me to access my app's storage. How can I read the other files present on the phone?

like image 753
bkk Avatar asked Feb 22 '17 14:02

bkk


People also ask

How do I read file content in react native?

On Android devices, you will need to append "file://" to load any file. You can do this using the package you mentioned or just manually. If you append it manually, react-native-fs can then be used to read the URI.

How do I see file extension in react native?

log('mime type: ' + fileInfo. type); console. log('extension: ' + fileInfo. extension);


1 Answers

I believe react-native-fs does support external storage in Android.

From the documentation:

ExternalDirectoryPath (String) The absolute path to the external files, shared directory (android only)

ExternalStorageDirectoryPath (String) The absolute path to the external storage, shared directory (android only)

like image 82
Lucas Avatar answered Oct 04 '22 03:10

Lucas