@blu3r4y/lzma
TypeScript icon, indicating that this package has built-in type declarations

2.3.3 • Public • Published

LZMA-JS ES6 + Types

This is an E6 module with type definitions of the LZMA-JS package by Nathan Rugg, which was then extended by Kaito Udagawa.

LZMA-JS is a JavaScript implementation of the Lempel-Ziv-Markov (LZMA) chain compression algorithm. Please find full details in the original README: https://github.com/LZMA-JS/LZMA-JS

Installation

Install with NPM or Yarn.

npm install @blu3r4y/lzma
yarn add @blu3r4y/lzma

Usage

Compress and decompress a string with compression level 1.

import { compress, decompress } from "@blu3r4y/lzma";

const data = "Hello World!";
const compressed = compress(data, 1);
const decompressed = decompress(result);

// data === decompressed

You may also use the callback interface or supply byte arrays.
The interface is the same as in the original package.

function compress(data: string | Uint8Array, mode: Mode);
function compress(
    data: string | Uint8Array,
    mode: Mode,
    on_finish: (result: Uint8Array, error: any) => void,
    on_progress?: (percent: number) => void
);

function decompress(data: Uint8Array);
function decompress(
    data: Uint8Array,
    on_finish: (result: string | Uint8Array, error: any) => void,
    on_progress?: (percent: number) => void
);

Package Sidebar

Install

npm i @blu3r4y/lzma

Weekly Downloads

226

Version

2.3.3

License

MIT

Unpacked Size

1.87 MB

Total Files

37

Last publish

Collaborators

  • blu3r4y