@seald-io/react-native-turbo-fs
TypeScript icon, indicating that this package has built-in type declarations

0.1.0-beta.0 • Public • Published

@seald-io/react-native-turbo-fs

React-Native Turbo-module for fast FS operations with native ArrayBuffer support

~20x faster for Append and ~49x faster for Read than react-native-fs on a Nexus 5X, because it avoids having to Base64 / Unbase64 the data back and forth.

Try the benchmarks under example.

iPhone Android
iPhone Android

Installation

npm install -S @seald-io/react-native-turbo-fs

Usage

import { read, append } from '@seald-io/react-native-turbo-fs'

const buffer = read('my-file-path', 512*1024, 0);

append('my-other-file', buffer);

Methods

read(filePath: string, size: number, position: number): ArrayBuffer

Reads a chunk of size size from the file at filePath, starting from position position.

Returns an ArrayBuffer of the data read.

If the file is not long enough, it returns an ArrayBuffer of length of what was actually read.

If there is nothing to read at that position, it returns an ArrayBuffer of length 0.

append(filePath: string, data: ArrayBuffer): void

Appends the given data to the end of the file at filePath.

Contributing

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

License

MIT by Seald SAS, based on the template of react-native-quick-base64 by Takuya Matsuyama

Package Sidebar

Install

npm i @seald-io/react-native-turbo-fs

Weekly Downloads

134

Version

0.1.0-beta.0

License

MIT

Unpacked Size

98.2 kB

Total Files

29

Last publish

Collaborators

  • arantes
  • seald
  • tex0l