mrousavy / react-native-blob-jsi-helper

A React Native library for accessing an ArrayBuffer of a Blob instance.
MIT License
131 stars 8 forks source link

react-native-blob-jsi-helper

Try Showtime!

A React Native library for directly accessing an ArrayBuffer of a Blob instance.

Note: This is a workaround. A long-term solution would be to implement this directly on the Blob instance in React Native Core.

Installation

npm install react-native-blob-jsi-helper

Usage

Accessing the ArrayBuffer of a Blob instance

import { getArrayBufferForBlob } from "react-native-blob-jsi-helper";

// ...

const blob = ...
const arrayBuffer = getArrayBufferForBlob(blob);

Creating a Blob from an ArrayBuffer

import { getBlobForArrayBuffer } from "react-native-blob-jsi-helper";

// ...

const arrayBuffer = ...
const blob = getBlobForArrayBuffer(arrayBuffer);

Performance

If you know me, you know that my libraries are as fast as they can get. react-native-blob-jsi-helper is no different - it is written in C++ JSI and is therefore really fast.

Blob -> ArrayBuffer

ArrayBuffer -> Blob

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT