jsf

js-split-file

A library to split big file to small binary data for nodejs and browsers.

Showing:

Popularity

Downloads/wk

42

GitHub Stars

3

Maintenance

Last Commit

17d ago

Contributors

2

Package

Dependencies

3

Size (min+gzip)

1.3KB

License

MIT

Type Definitions

Tree-Shakeable

Yes?

Categories

Readme

js-split-file

Dependency Status devDependency Status Build Status: Windows Github CI npm version Downloads gzip size type-coverage

A library to split big file to small binary data for nodejs and browsers.

install

npm i js-split-file

usage

import SplitFile from "js-split-file";
// <script src="js-split-file/js-split-file.min.js"></script>

// react-native:
import SplitFile from "js-split-file/react-native";

const splitFile = new SplitFile();
const binary = new Uint8Array([1, 2, 3]); // for browser, from File or Blob to Uint8Array; for nodejs, from Buffer to Uint8Array
const blocks = splitFile.split(binary, "a.pdf");
const piece = splitFile.decodeBlock(blocks[0]);

options

const blocks = splitFile.split(new Uint8Array([1, 2, 3]), "a.pdf", 10000); // each piece's size <= 10000B

dependencies

  • Uint8Array, or polyfill like core-js
  • for browser, it need TextEncoder and TextDecoder, if the browsers don't support them, use polyfill like text-encoding

change logs

// v2
import SplitFile from "js-split-file/nodejs";
import SplitFile from "js-split-file/browser";

// v1
import { SplitFile } from "js-split-file/nodejs";
import { SplitFile } from "js-split-file/browser";

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial