All Projects → mrousavy → react-native-blob-jsi-helper

mrousavy / react-native-blob-jsi-helper

Licence: MIT License
A React Native library for accessing an ArrayBuffer of a Blob instance.

Programming Languages

C++
36643 projects - #6 most used programming language
java
68154 projects - #9 most used programming language
typescript
32286 projects
Objective-C++
1391 projects
objective c
16641 projects - #2 most used programming language
CMake
9771 projects

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.

  • Zero bridge-traffic.
  • Zero serialization/deserialization.

Blob -> ArrayBuffer

  • For a 10 kB Buffer, I have measured 1ms.
  • For a 12 MB Buffer, I have measured 13ms.

ArrayBuffer -> Blob

  • For a 10 kB Buffer, I have measured 0.05ms.
  • For a 12 MB Buffer, I have measured 0.3ms.

Contributing

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

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].