Adam Sancho
Adam Sancho

Reputation: 187

How to read or download a file in React Native?

I have a React-Native project and I need to read the data from a file which is on Internet, so, I need to read the data from the URL or download the file, read it and then delete the file.

Can anyone help me?

Thank you.

Upvotes: 1

Views: 11199

Answers (2)

Hariks
Hariks

Reputation: 1889

For native filesystem managing (creation of local files, deletion etc) you could use this module, https://github.com/johanneslumpe/react-native-fs

For downloading/uploading you could either use the react native fetch https://facebook.github.io/react-native/docs/network.html or the above fs module.

Upvotes: 2

ilyapt
ilyapt

Reputation: 1829

React Native provides the Fetch API for your networking needs. Fetch will seem familiar if you have used XMLHttpRequest or other networking APIs before. You may refer to MDN's guide on Using Fetch for additional information.

https://facebook.github.io/react-native/docs/network.html

Upvotes: 1

Related Questions