Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support typed arrays Int8Array #291

Open
nigelsim opened this issue Aug 18, 2023 · 0 comments
Open

Support typed arrays Int8Array #291

nigelsim opened this issue Aug 18, 2023 · 0 comments

Comments

@nigelsim
Copy link

nigelsim commented Aug 18, 2023

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

react-native-blob-util@0.18.6
pako@1.0.11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant