joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.85k stars 786 forks source link

"Error: No such file" when hashing camera file #804

Open ericlifs opened 2 years ago

ericlifs commented 2 years ago

Issue

Hi everyone!

Thanks for this awesome library, I find it very useful for me. As the title says, I'm doing a POC where I'm trying a take a picture or record a video using react-native-vision-camera (this is working fine) and then calculate a hash off of it. Here's a simplified code snippet of what I'm doing:

cameraRef.current.startRecording({
  onRecordingFinished: async (video) => {
    const hash = await RNFetchBlob.fs.hash(video.path, "sha256");
    console.log(hash);
  },
});

When trying to calculate the hash I'm getting the following error:

Error: No such file 'file:///data/user/0/com.firstproject/cache/VisionCamera-20220728_1420442449382875164019018.mp4'

I have tried different approaches to fix it (change react-native-vision-camera to expo-camera, copy the file to a different location before hashing it) but with no luck.

I'm not sure if I'm missing something.

Thanks,

Eric.

Environment

choijiho0021 commented 5 months ago

Do not put "file:///"

ex. file:///data/user/0/com.firstproject/cache/VisionCamera-20220728_1420442449382875164019018.mp4 ( X ) data/user/0/com.firstproject/cache/VisionCamera-20220728_1420442449382875164019018.mp4 ( O )