Questions tagged [react-native-fs]
208 questions
5
votes
4 answers
Write files to the Android external storage using React Native FS
My React Native Android application needs to save a JSON file in the special folder located in the external storage. I am trying to do it using RNFS (https://github.com/itinance/react-native-fs) this way:
const saveData = async () => {
var path…

Amphyx
- 669
- 4
- 12
- 24
5
votes
1 answer
How to save downloaded files and view in File app using React Native in iOS?
I am using react-native-fs to download files from server and save them. Once they are downloaded I am using react-native-file-viewer to open them. This process totally works fine: I am able to download and open it in the viewer, but I am not able to…

Rishabh
- 3,752
- 4
- 47
- 74
5
votes
2 answers
react native fs library not writing files
when i use react-native-fs to create file, success in callback arrives but the file isn't in my android/data/com.myapp/files/test.txt library.
No errors in logcat so i'm wondering why my code with simple App.js not working.
/**
* Sample React…

Vojtěch Prchal
- 141
- 1
- 2
- 11
5
votes
1 answer
Fail to run Jest unit test in react-native with react-native-fs lib
I create a new react-native app with the latest version, the default testing works well.
Then I use 'react-native-fs' lib to write a file in my app and it works fine.
But I try to run the testing command, it failed.
> TestJest@0.0.1 test…

truong thanh
- 51
- 1
- 2
5
votes
1 answer
Attempting to add an openFile method to React Native, can't call getCurrentActivity
Inside a fork of react-native-fs ( https://github.com/johanneslumpe/react-native-fs ), I'm attempting to add this code:
public class RNFSManager extends ReactContextBaseJavaModule {
public RNFSManager(ReactApplicationContext reactContext) {
…

freyley
- 4,145
- 3
- 20
- 25
4
votes
0 answers
How to save an excel file using react-query with react-native-fs?
I am using react-query wrapped around axios for APIs and trying to save/download the response to an excel file and store it. Below is the code and the api response. I am unable to figure out if I'm missing out on any headers, if the response type is…

Mohanish
- 61
- 1
- 8
4
votes
0 answers
React native - Not able to perform any file system operation using react-native-fs
Suddenly after changing target SDK version to 30 all the file system operations using react-native-fs like mkdir, moveFile, copyFile etc stopped working on react-native android app for android version 11. I'm aware of new scoped storage introduced…

vindev
- 2,240
- 2
- 13
- 20
4
votes
0 answers
react-native-fs library is not moving or copying files - weird results
npmPackages:
@react-native-community/cli: ^4.13.0 => 4.13.0
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-windows: Not Found
react-native-fs: ^2.16.6
react-native-image-picker: ^2.3.4
IDEs:
…

DerpyNerd
- 4,743
- 7
- 41
- 92
4
votes
1 answer
How to get files in main directory in a react native project?
I am trying to get file names in main directory of my react native project. I have used "react-native-fs" to do it.
Here is my code;
const getFileNames = () => {
const path = FS.DocumentDirectoryPath;
console.log(path);
};
And it doesn't…

shuster
- 184
- 3
- 10
4
votes
4 answers
How to mkdir with React-Native-FS
I'm trying to add functionality to my RN app that will allow users to create a new directory within their phone's file system.
I have tried to write the code so that the function creates a directory in the path /storage/emulated/0/AppName/NewFolder,…

Tycholiz
- 1,102
- 4
- 17
- 33
4
votes
2 answers
Read local asset in react-native-fs
I have a file ("static.zip") in the root directory of my react-native project that I'm trying to access it via the react-native-fs library. Given this example, I thought it would be as easy as this on iOS:
sourcePath =…

tassock
- 1,633
- 1
- 17
- 32
4
votes
2 answers
React-Native: How to open locally bundled binary file
I'm writing a react-native app, and I want it to deploy with a zip file that contains a device firmware update.
Before letting the user send the update, I need my code to open the zip and do some validation of its contents.
I've found lots of…

ArtHare
- 1,798
- 20
- 22
4
votes
2 answers
React-native Invalid UTF-8 detected while trying to read a image file
I am trying to read an image file using the URI using react-native-fs and redux-saga:
file:///var/mobile/Containers/Data/Application/605FB6C0-869C-4128-883E-A59616933C64/Documents/images/52108C66-A087-4942-9DD4-22CBD0327089.jpg
Below is the line…

Sumanth Jois
- 3,146
- 4
- 27
- 42
4
votes
1 answer
Try to use react-native-fs in create-react-native-app project (expo)
I'm trying to use react-native-fs in my app to upload files etc.
I followed the installation like the documentation, make the import and i'd put this code for the test :
componentDidMount(){
const path = RNFS.DocumentDirectoryPath +…

E.D
- 831
- 3
- 16
- 33
4
votes
1 answer
React-native Writing Pdf files Using React-Native-fs (IOS)
Need to write a file(pdf) and store it in device memory. I'm using react-native-fs library.
I want to make users able to read this file using iBooks as well.
These are react-native-fs 's constants
MainBundlePath (String) The absolute path to…

Burak Karasoy
- 1,682
- 2
- 21
- 33