0.0.5 • Published 7 months ago
lzma1 v0.0.5
lzma1
This is a fork of Nathan Rugg's package that adds types and makes the logic more structured and readable.
Installation
!NOTE This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you will have to convert to ESM or use the dynamic
import()
function.
npm
npm install lzma1
deno
Since v1.28+
import from npm registry using npm:
prefix.
import {
compress,
decompress,
} from "npm:lzma1@latest";
browser
<script type="module">
import { compress, decompress } from "https://esm.sh/lzma1@latest";
</script>
API
compress(data: string | Uint8Array, mode?: Mode): Int8Array
decompress(data: Uint8Array | ArrayBuffer): string | Int8Array
Usage
Compress and decompress a string with compression level 1.
import {
compress,
decompress,
} from "lzma1";
const data = "Hello World!";
const compressed = compress(data, 1);
const decompressed = decompress(result);
// data === decompressed
LZMA header
More information about the LZMA header.