-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Description
Description
I cannot decode the base64 data provided by the ImageStore for my images. I want to send a raw byte stream over the wire to my server, but I cannot produce a byte stream that is a valid jpeg. I haven't tried this yet on iOS, this might be a platform specific problem. Will update with further findings. Looking for discussion on how others have solved this problem.
Do Android and iOS use different base64 encoding standards based on OS and OS version? Looks like ReactNativeFetchBlob has been able to get around this by implementing the decoding step in native code.
Reproduction Steps and Sample Code
I'm using https://github.com/mathiasbynens/base64 to decode the base64 image, resulting in a broken file.
ImageStore.getBase64ForTag(
uri,
(base64ImageData: string): void => {
const raw = b64.decode(base64ImageData);
networker.uploadImage(raw);
},
(error: any): void => {
throw Error("Failed to find photo at specified uri);
});
Solution
There are a bunch of solutions here I imagine, and I'm surprised there isn't a solution readily available here. One way would be provide an api to decode these base64 encoded images so I can get access to the raw bytestream.
Additional Information
- React Native version: [0.43]
- Platform: [Android]
- Development Operating System: [OS X]
- Dev tools: [Genymotion Android 6.0.0]