deno.land / x / brotli@v0.1.4

scripts/
import * as brotli from "https://deno.land/x/brotli@v0.1.4/mod.ts";

Functions

compress

Compress a byte array.

decompress

Decompress a byte array.

deno_brotli

stars workflow releases deno version deno doc Discord license issues

This module provides brotli support for deno and the web by providing simple bindings using rust-brotli compiled to webassembly.

Usage

Compression

import { compress } from "https://deno.land/x/brotli/mod.ts";

const text = new TextEncoder().encode("X".repeat(64));

console.log(text.length);                   // 64 Bytes
console.log(compress(text).length);         // 10 Bytes

Decompression

import { decompress } from "https://deno.land/x/brotli/mod.ts";

const compressed = Uint8Array.from([ 27, 63, 0, 0, 36, 176, 226, 153, 64, 18 ]);

console.log(compressed.length);             // 10 Bytes
console.log(decompress(compressed).length); // 64 Bytes

Other

Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt and commit messages are done following Conventional Commits spec.

Licence

Copyright 2020-present, the denosaurs team. All rights reserved. MIT license.

brotli
🗜 Brotli wasm module for deno
GitHub Stars
53

Version Info

Tagged at
a year ago

External Dependencies