'Reading a text file stored in mobile phone storage using React-Native
I want to read the content of a text file stored inside the downloads folder in an Android phone. How can I do this using React-Native?
Solution 1:[1]
You can use react-native-fs:
...
// typescript style
import * as RNFS from 'react-native-fs';
...
// readFile(filepath: string, encoding?: string)
RNFS.readFile(filePath, 'ascii').then(res => {
...
})
.catch(err => {
...
console.log(err.message, err.code);
...
});
...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RamaProg |
