just-lzma
v4.0.1
Published
A JavaScript implementation of the Lempel-Ziv-Markov (LZMA) chain compression algorithm
Maintainers
Readme
just-lzma
just-lzma is a JavaScript implementation of the Lempel-Ziv-Markov (LZMA) chain compression algorithm.
No web workers. No async. ES6 compatible. Just LZMA!
The codebase is a fork of LZMA-JS written by Nathan Rugg.
Install
yarn add just-lzmaUsage
import lzma from "just-lzma";
const str = "Hello World";
const compressed = lzma.compress(str);
const decompressed = lzma.decompress(compressed);
console.log(str === decompressed); // -> trueYou can also set the compression level on compress via an optional second parameter:
// value ranges from `1` (fastest) to `9` best
const compressed = lzma.compress("Hello World", 1);Typescript
The repo has typescript support. You can view the types in index.d.ts.
Compatibility
just-lzma is compatible with the reference implementation of LZMA, for example, the lzma command.
