[native] Implement BlobUtils expo-module on Android
Summary:
The core part of ENG-3718. The issue description is important to understand the context of this diff.
In short: Implemented two functions that provide a way to directly convert Blob <--> ArrayBuffer without going through base64 encoding/decoding which is extremely inefficient.
Other helpful resources:
Depends on D7973
Test Plan:
Built the Android, tested using the following snippet:
const array1 = new Uint8Array([1, 2, 3, 4, 5]); const blob1 = blobFromArrayBuffer(array1.buffer); console.log('blob1', blob1); const decoded = new Uint8Array(arrayBufferFromBlob(blob1)); console.log('decoded', decoded); const blob2 = blobFromArrayBuffer(decoded.buffer); console.log('blob2', blob2); // line below requires amending exports in native/media/blob-utils.js console.log('Another way:', await blobToDataURI(blob2).then(dataURIToIntArray));
Reviewers: atul, marcin
Reviewed By: atul, marcin
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D7974