https://github.com/nberlette/lz4-wasm
Super lightweight LZ4 compression in TypeScript, powered by WebAssembly. Weighs in at ~10KB!
https://github.com/nberlette/lz4-wasm
lz4 lz4-compression lz4-compressors typescript wasm
Last synced: 6 months ago
JSON representation
Super lightweight LZ4 compression in TypeScript, powered by WebAssembly. Weighs in at ~10KB!
- Host: GitHub
- URL: https://github.com/nberlette/lz4-wasm
- Owner: nberlette
- License: mit
- Created: 2025-03-25T07:31:33.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-03-27T16:59:29.000Z (6 months ago)
- Last Synced: 2025-03-27T17:29:54.437Z (6 months ago)
- Topics: lz4, lz4-compression, lz4-compressors, typescript, wasm
- Language: Rust
- Homepage: https://jsr.io/@nick/lz4
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @nick/lz4
Lightweight LZ4 compression utility powered by WebAssembly.
---
## Install
```sh
deno add jsr:@nick/lz4
``````sh
bunx jsr add @nick/lz4
``````sh
pnpm dlx jsr add @nick/lz4
``````sh
yarn dlx jsr add @nick/lz4
``````sh
npx jsr add @nick/lz4
```## Usage
```ts
import * as lz4 from "@nick/lz4";// let's fetch a huge webassembly binary (~4MB)
const data = await fetch("https://plugins.dprint.dev/typescript-0.94.0.wasm")
.then((res) => res.bytes());
console.assert(data.length === 4083340); // OKconst compressed = lz4.compress(data);
console.assert(compressed.length === 1644878); // OKconst decompressed = lz4.decompress(compressed);
console.assert(decompressed.length === data.length); // OK
console.assert(decompressed.every((v, i) => v === data[i])); // OK
```---
[MIT] © [Nicholas Berlette]. All rights reserved.
[Github] · [Issues] · [Docs]
[MIT]: https://nick.mit-license.org
[Nicholas Berlette]: https://github.com/nberlette
[Github]: https://github.com/nberlette/lz4-wasm
[Issues]: https://github.com/nberlette/lz4-wasm/issues
[Docs]: https://jsr.io/@nick/lz4/doc