Questions tagged [react-native-fs]

208 questions
4
votes
2 answers

react-native-pdf-view - How to populate pdfView with base64 or blob

I am using the react-native-pdf-view library and I am having trouble populating the PDFView with a pdf. How my project works is that I receive a base64 pdf from the server where I then save to the android file system by using the library…
Larney
  • 1,674
  • 4
  • 23
  • 47
3
votes
1 answer

react-native-fs ENOENT: open failed: EACCES (Permission denied), open '/storage/emulated/0/Download/ after reinstall

Hello everyone Environment : Android 11 react-native 0.68.5 react-native-fs 2.20.0 Need: Save files persistent to the application (if I uninstall the application the files need to persist). If I reinstall the application I need to be able to…
3
votes
2 answers

react native file system, fs, cannot find taken pictures

In my ReactNative application I am using "react-native-vision-camera": "^2.13.5" for taking pictures. After the picture is taken and uploaded, I want to delete it from the device, but the RNFS (react-native-fs) cannot find the file by the given…
3
votes
0 answers

How to get all the pdf files available in internal storage of android in react native

I am using react-native-fs for reading files in device's external storage. I want to get all pdf books stored in an android device and list them in the screen. Searched in google, read docs in react-native-fs but not succeed getting all pdf books.…
3
votes
0 answers

react-native-fs Android 11 save File in /storage/emulated/0/Download

we are using react-native-fs for android 11. i have the problem that i can't save Pfd and Excel files on the Downloads folder (/storage/emulated/0/Download) anymore, because we edit the files via other apps and then upload the file again in our app.…
Benq
  • 49
  • 1
  • 3
3
votes
0 answers

can read /storage but cannot read /storage/emulated in react-native-fs [Error: Attempt to get length of null array]

I'm trying to write an app that needs to navigate through file system (directory based music player). For that I'm using react-native-fs. The problem is that I can read content of the /storage directory but when I'm trying to read any deeper like…
3
votes
1 answer

json file not updating in react native

i want to write to a JSON file so i used react-native-fs here is the code: const add = (n, p, pr) => { var RNFS = require('react-native-fs'); var filePath = RNFS.DocumentDirectoryPath + '/items.json'; RNFS.writeFile(filePath,…
lcl code base
  • 101
  • 2
  • 9
3
votes
0 answers

Access jobId to stop download react-native-fs

How do I access jobId during the download. I have my download function stored in a separate *.js file RNFS.downloadFile({ fromUrl: item.thumb, toFile: `${RNFS.DocumentDirectoryPath}/${item.id}.jpg`, begin: (res) => { …
Oleksandr Fomin
  • 2,005
  • 5
  • 25
  • 47
3
votes
2 answers

React Native - Get file name from android content uri

I need to get file name from android content uri, for example: content://com.android.providers.downloads.documents/document/15 I try to used react-native-fs stat but it return error of "File does not exist". How can I do it?
david890ch
  • 197
  • 2
  • 10
3
votes
0 answers

How to get real path from URI of a file in sdcard?

I'm using react-native-document-picker in order to pick files and send them to the server. After picking the file, I use RNFetchBlob.fs.stat(uri) from rn-fetch-blob package to get the real path from the URI that the picker gives me. It works fine…
3
votes
0 answers

React native video from local file

I am using react-native-video (v 5.0.2) and try to play file from local. It's working in Android but not working in iOS. I created the file that I want to play with react-native-fs. This is my code: Write file: const localFilePath =…
3
votes
3 answers

react-native-fs path not found?

import RNFS from 'react-native-fs'; var path = RNFS.DocumentDirectoryPath + '/test.txt'; RNFS.writeFile(path, 'Lorem ipsum dolor sit amet', 'utf8') .then(success => { console.log('FILE WRITTEN!'); }) .catch(err => { …
ebyte
  • 1,469
  • 2
  • 17
  • 32
3
votes
1 answer

In a react-native android project,How to copy a folder from assets to the DocumentDirectoryPath?

I am using a react-native project in which,I want to copy the contents of a certain folder in assets inside android to RNFS.DocumentDirectoryPath. How can this be performed? I have used the attribute copyFileAssets(). copyfile() { …
3
votes
1 answer

React native file system to read directory recursively to get sub folder and items in it

I can able to read the files in a directory using following function const path = RNFS.DocumentDirectoryPath; RNFS.readDir(path) .then((result) => { console.warn(result); const Files = []; if(result != undefined…
Jothi Kannan
  • 3,320
  • 6
  • 40
  • 77
3
votes
1 answer

react-native-fs.the actual document directory path in android

I tried the code for creating a file, and i created two files, and that is // require the module var RNFS = require('react-native-fs'); // create a path you want to write to var path = RNFS.DocumentDirectoryPath + '/test.txt'; …
Pons Suarez
  • 83
  • 2
  • 8
1 2
3
13 14