-1

I want to change my local image into blob file type. How can I do it with react-native-fs. This is what I tried below

RNFS.readFile('../../assets/imgs/profile.jpg', 'base64')
    .then(res =>{
      console.log(res);
      alert("res");
});

This is what I'm trying so far but it gives me a warning - " no such file or directory, open '../../assets/imgs/profile.jpg'

Warning

Shubham Bisht
  • 577
  • 2
  • 26
  • 51

2 Answers2

0

You can use rn-fetch-blob library

0

The problem is this you are going to access the system directory.

../../assets/imgs/profile.jpg

react-native-fs give access to the native filesystem.

the image should be placed on your mobile and give the right image path

if the image inside the document directory so you can access the document path using

RNFS.DocumentDirectoryPath + '/profile.jpg'
Zeeshan Ansari
  • 9,657
  • 3
  • 26
  • 27