alinz / react-native-share-extension

react-native as an engine to drive share extension
MIT License
763 stars 398 forks source link

Base64 of selected image #78

Closed pierretanguay closed 6 years ago

pierretanguay commented 6 years ago

I am trying to extract the base64 of the image contained in the "value". Is there any way to do that or do I need another package?

pierretanguay commented 6 years ago

I used RNFS to do this:

await RNFS.readFile(this.state.value.substring(7), "base64")  //substring(7) -> to remove the file://
    .then(res => this.setState({base64: res}))  //res will contain base64 with data:/image/*:base64;..