Questions tagged [react-native-fs]

165 questions
2
votes
2 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…
anDev
  • 379
  • 6
  • 16
2
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,…
2
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) => { …
2
votes
1 answer

How to delete react-native-image-crop-picker image from /storage/emulated/0/Pictures

When the image is captured it saves two images, one original and the other compressed and gives the path of compressed image in image.path. How can I disable saving of any image in gallery, I just need the base64 to work…
2
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…
2
votes
1 answer

React Native: Invariant Violation when using "React-Native-FS"

I have been trying to use "React-Native-FS" while developing a react native application. However, whenever I try to import "React-Native-FS" to my app I get the following message: Invariant Violation: Native Module Cannot Be Null Does anyone have…
2
votes
0 answers

How can I read a local css file to inject it into a react-native WebView?

In my react-native app, I want to inject css into pages loaded by react-native WebView. (I am displaying online websites that should look slightly different within my app's WebView than they would normally) The most promising approach I found so far…
user5695186
2
votes
2 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
  • 969
  • 5
  • 15
2
votes
1 answer

Saving a photo taking a very long time

I want users to be able to take photos from within my app and have the photos save to their gallery (so that I can later view them in a photo-picker). I have the following code from react-native-camera, it's basically the bare-bones demo…
2
votes
0 answers

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() { …
2
votes
0 answers

Is there a way/library to store files in the app's iCloud Container in React Native?

Looking for a way to store files (a realm database) to iCloud for backup purposes. The user can create and restore those backups. I have tried using RNFS (react-native-fs). But got stuck when looking for a way to read the location of the iCloud…
2
votes
0 answers

React native fs upload files issue

I am using https://github.com/itinance/react-native-fs for upload files, but it's not sending any request to my server and sometimes it throws a socket-io issue, please check my current code that I have used. I have tried simple fetch using form…
2
votes
3 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
  • 727
  • 1
  • 11
  • 27
2
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
  • 2,930
  • 4
  • 32
  • 65
2
votes
1 answer

react native fs ios download time out

i'm using react-native fs to download content from a CMS into an react-native app. The idea is to use the app to serve the online content/website for offline use. The app does well on Android without throwing any errors, but on the iPad (ios 11.4)…
1 2
3
10 11