Skip to content

xseman/lzma1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Dec 10, 2024
dcb3006 · Dec 10, 2024

History

46 Commits
Dec 10, 2024
Dec 10, 2024
Dec 10, 2024
Nov 27, 2024
Nov 27, 2024
Dec 10, 2024
Dec 10, 2024
Feb 18, 2023
Dec 10, 2024
Nov 27, 2024
Nov 27, 2024
Dec 10, 2024
Dec 10, 2024
Dec 10, 2024
Nov 27, 2024

Repository files navigation

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.

lzma

Related