# brotli

> brotli, a magmalake tin: A Mojo binding to libbrotli, the last of the seven Parquet page codecs.

[magmalake](https://magmalake.dev/) [brotli](https://magmalake.dev/s/brotli)

A Mojo binding to libbrotli, the last of the seven Parquet page codecs. Bound rather than written: RFC 7932 needs two prefix-code forms, context maps, block-type switching, a distance cache and a 122 KB static dictionary with 121 word transforms that are part of the format itself.

Install

```
pixi shelf add brotli-mojo
```

Version

`0.1.4` on mojoshelf

Source

[GitHub](https://github.com/magmalake/brotli.mojo) [README](https://github.com/magmalake/brotli.mojo#readme) [Benchmark history](https://magmalake.github.io/brotli.mojo/benchmarks/)

## Works today

- One-shot compress and decompress, quality 0–11
- A Brotli stream records no uncompressed size, so sized and unsized decoding are separate calls
- The shim is dlopen'd once, not per call

Checked against CPython's brotli package, on streams it produced and this one had never seen

- [thrift](https://magmalake.dev/s/thrift) compact + binary protocol
- [zstd](https://magmalake.dev/s/zstd) libzstd
- [lz4](https://magmalake.dev/s/lz4) liblz4
- [snappy](https://magmalake.dev/s/snappy) pure Mojo
- [deflate](https://magmalake.dev/s/deflate) DEFLATE · gzip · pure Mojo
- [hashes](https://magmalake.dev/s/hashes) CRC-32 · murmur3 · XXH64
- [memory-region](https://magmalake.dev/s/memory-region) bytes addressed by offset · shared mappings
- [threads](https://magmalake.dev/s/threads) pthreads · atomics · parallel\_for
- [Every tin](https://magmalake.dev/tins)

[A magmalake project](https://magmalake.dev/)

Apache 2.0 · © 2026 Marius Seritan
