Skip to main content
Deno 2 is finally here 🎉️
Learn more

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-2022, the denosaurs team. All rights reserved. MIT license.