2.2.1 • Published 4 years ago

js-split-file v2.2.1

Weekly downloads
24
License
MIT
Repository
github
Last release
4 years ago

js-split-file

Dependency Status devDependency Status Build Status: Linux Build Status: Windows 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";
2.2.1

4 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

7 years ago

1.1.7

7 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago