itinance / itinance/react-native-fs

Trying to do a md5 hash on a cameraRoll image

Open
#529 0 comments 9 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

I'm trying to do a md5 hash on images in the cameraRoll but it gives me this error:

Possible Unhandled Promise Rejection (id: 1):
Error: ENOENT: no such file or directory, open '/var/mobile/Containers/Data/Application/E7FE35C5-A7AE-4DFD-9552-2B2181F4B473/Documents/hej.jpg'

CameraRoll.getPhotos({first: 5, assetType: 'Photos',})
.then(data => data.edges.map(e => RNFS.copyAssetsFileIOS(e.node.image.uri, RNFS.DocumentDirectoryPath+ "/hej.jpg", 1,1)
.then(stat=> {
console.log(stat)
RNFS.hash(stat, 'md5')
.then(hash=>console.log(hash)) })))

The console.log(stat) gives me: /var/mobile/Containers/Data/Application/E7FE35C5-A7AE-4DFD-9552-2B2181F4B473/Documents/hej.jpg

The following works on android.

CameraRoll.getPhotos({first: 5, assetType: 'Photos',})
.then(data => data.edges.map(e => RNFS.stat(e.node.image.uri)
.then(stat=> {
console.log(stat)
RNFS.hash(stat.originalFilepath, 'md5')
.then(hash=>console.log(hash)) })))

Thankful for help!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.