React-native-fs: Error: ENOENT: no such file or directory

Created on 24 Aug 2016  Â·  5Comments  Â·  Source: itinance/react-native-fs

I'm trying to get base64 out of the resized image but running readFile gives me this error:

Error: ENOENT: no such file or directory, open 'file:/data/data/com.app/cache/1472039430399.JPEG'(…)

any idea why?

Most helpful comment

@johanneslumpe I have the same issue. I use .replace('file:/', '') but when file has spaces like: "Introdution to Java.pdf" the error appears again. Any solution?

All 5 comments

@fgrs are you sure that the URI is supposed to only start with file: instead of file://? Can you access the same URI using native Java code?

RNFS.readFile(resizedImageUri.replace('file:/', ''), 'base64').then((base64) => {

did the trick, looks like returned path is wrong should start with data/data/...

@fgrs ok, so then this is not an issue with RNFS I assume :) Feel free to reopen if you still think that we can do something here.

@johanneslumpe I have the same issue. I use .replace('file:/', '') but when file has spaces like: "Introdution to Java.pdf" the error appears again. Any solution?

@sergiocloud try to replace it like:
path.replace(/%20/g, '\ ')

Works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JohnRyanTsai picture JohnRyanTsai  Â·  3Comments

zaheerahmad92001 picture zaheerahmad92001  Â·  3Comments

barnir picture barnir  Â·  3Comments

onzag picture onzag  Â·  3Comments

AbdelkaderOumrani picture AbdelkaderOumrani  Â·  3Comments