react-native-blob-util icon indicating copy to clipboard operation
react-native-blob-util copied to clipboard

Support typed arrays Int8Array

Open nigelsim opened this issue 2 years ago • 0 comments

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');

[email protected] [email protected]

nigelsim avatar Aug 18 '23 10:08 nigelsim