react-native-blob-util
react-native-blob-util copied to clipboard
Support typed arrays Int8Array
I am trying to use pako to compress data before saving it to disk. However, it returns Int8Array, which causes ReactNativeBlobUtil to throw an exception TypeError: "data" must be an Array when encoding is "ascii". The work around is to use a spread operator, but this is pretty messy.
Example
import pako from 'pako';
const deflated = pako.gzip(JSON.stringify({'a': 'Some Object'}));
await ReactNativeBlobUtil.fs.writeFile(`${ReactNativeBlobUtil.fs.dir.DocumentDir}/file.gz`, deflated, 'ascii');