Questions tagged [react-native-fs]

208 questions
53
votes
5 answers

How to download a file with React Native?

I am building an app with React Native, for Android and iOS. I am trying to let the user download a PDF file when clicking on a button. react-native-file-download does not support Android react-native-fs does nothing when I trigger downloadFile…
Arnaud
  • 4,884
  • 17
  • 54
  • 85
15
votes
1 answer

RNFS.exists() always returns TRUE

I am using react-native-fs and for some reason whenever I use the exists() method it is always returning as TRUE. A sample of my code looks like this: let path_name = RNFS.DocumentDirectoryPath + "/userdata/settings.json"; if…
kojow7
  • 10,308
  • 17
  • 80
  • 135
14
votes
3 answers

Open a file (pdf, word, excel, png etc.) on device with its default application in react-native

I'm using react-native-fs to download a file(pdf, word, excel, png etc.) and I need to open it in other application. Is it possible to open downloaded file with Linking or better open a dialog with possible apps like when using Sharing? Linking in…
14
votes
3 answers

How to save pdf to android file system and then view PDF - react-native

I am using the react-native-fs and I am trying to save a base64 of a pdf file to my android emulators file system. I receive base64 encoded pdf from the server. I then decode the base64 string with the line: var pdfBase64 =…
Larney
  • 1,674
  • 4
  • 23
  • 47
11
votes
1 answer

React native fs iOS not showing files in the document directory

I am working on a react native project. I need to store the captured images in the custom folder. I am using react native fs library for that. I am able to create the image in the desired directory but I am not able to see those images in my…
Pankaj Agrawal
  • 1,469
  • 2
  • 17
  • 27
9
votes
2 answers

React-native-android - How to save an image to the Android file system and view in the phone's 'Gallery'

Is it possible to save an image to the android's local file system so it can be viewed from the phone's 'Gallery' and in a folder?? I found this react-native-fs library but after studying the documentation and working through an example I am still…
8
votes
3 answers

How to avoid "Excessive number of pending callbacks: 501" error during images download in React Native?

I need to download a collection of images on button press. Currently, I'm doing it this way using react-native-fs: const downloadImageItem = async (imgUrl, id) => { const path = `${RNFS.DocumentDirectoryPath}/${id}.jpg`; RNFS.downloadFile({ …
7
votes
2 answers

How to calculate checksum in React Native and Node?

I'm uploading an image file from React Native to AWS Lambda (Node 10.x) and want to verify the hash of the file I've sent matches the file received. To do this I'm using hashing in React Native and again in Lambda, but the hashes never match. Here…
Fook
  • 5,320
  • 7
  • 35
  • 57
7
votes
1 answer

React-Native method hangs and does not throw an error

I am using the react-native-fs module, however my app seems to be freezing on it. I have the following piece of code in one of my React-Native methods: console.log("One") await RNFS.downloadFile({ fromUrl: 'http://example.com/data/blah.zip', …
kojow7
  • 10,308
  • 17
  • 80
  • 135
6
votes
1 answer

react-native-fs [Error: Directory could not be created]

I am trying to create a directory using RNFS.mkdir, but it's warning "Directory could not be created"... "react-native-fs": "^2.18.0", "react-native": "0.64.0", The function that I use to write is the following: const phoneStorageDir =…
6
votes
2 answers

Downloading private videos inapp react native

I am trying to implement something in react native: I have a url of video which i'm showing in react native video component, how can i give a button to download that same video in mobile but it should not appear in gallery. Also if the video is…
6
votes
2 answers

EISDIR: illegal operation on a directory, read in React Native file system

I'm trying simple code to copy a file to another external folder using this code: RNFS.copyFile(sourcePath, destinationPath) .then(result => { console.log('file copied:', result); }) .catch(err => { console.log('error: ', err.message,…
Irfan Muhammad
  • 715
  • 2
  • 8
  • 20
6
votes
2 answers

Get file from react-native to upload image same as ` `

I have tried doing var photo = { uri: uriFromCameraRoll, type: 'image/jpeg', name: 'photo.jpg', }; and using axios var body = new FormData(); body.append('authToken', 'secret'); body.append('photo', photo); body.append('title', 'A…
kvadityaaz
  • 1,441
  • 1
  • 16
  • 23
6
votes
2 answers

Move file from tmp to documents using react-native-fs

I'm trying to move a file selected from a document picker to the Document Directory using react-native-fs and react-native-document picker. However, I get the error below: Error: “file name.mp3” couldn’t be moved to “Documents” because either the…
liver
  • 498
  • 4
  • 21
5
votes
2 answers

Save file inside Documents/Downloads react-native

Is it possible to save files with react-native inside Documents or Downloads? I am trying to save a pdf file with react-native-fs: let file = await RNHTMLtoPDF.convert(options) const destinationPath = RNFS.DocumentDirectoryPath + "/" + fileName +…
user2994290
  • 329
  • 4
  • 13
1
2 3
13 14