Hi. At first, thank you very much for this lib, it is really awesome!
But I got some trouble when tried to get the captured photo size in bytes.
In readme file is only guide to get the video size on iOS .
Is there any solutions for android photo?
Well I have found the solution.
You just need to install react-native mime-types, base64 and RNFetchBlob and watch my code:
let base64 = require('base-64');
let mime = require('mime-types')
const options = {};
if(this.refs.cam) {
this.refs.cam.capture({ metadata: options })
.then((data) => {
RNFetchBlob.fs.readFile(data.path, 'base64').then(r => {
var decodedData = base64.decode(r);
data.mime = mime.lookup(data.path);
data.size = decodedData.length;
this.share([data])
this.setState({ camera: false })
})
})
.catch(err => console.error(err));
}
Most helpful comment
Well I have found the solution.
You just need to install react-native mime-types, base64 and RNFetchBlob and watch my code: