Skip to content

Brotli ​

Design Notes ​

  • All APIs return byte[]
  • ReadOnlySpan<byte> overloads are convenience wrappers
  • No format auto-detection — you must use the same algorithm for decompressing
  • Stream overload reads from the beginning of the stream if it is seekable

Philosophy ​

  • Explicit behavior
  • Predictable memory usage
  • Defensive extraction
  • No automatic heuristics
  • No magic format guessing

Methods ​

Compress ​

csharp
using JASE.Compression;

byte[] compressed = Brotli.Compress(data);
byte[] compressed = Brotli.Compress(data, CompressionLevel.Fastest);
byte[] compressed = Brotli.Compress(data.AsSpan());

Decompress ​

csharp
using JASE.Compression;

byte[] original = Brotli.Decompress(compressed);
byte[] original = Brotli.Decompress(compressed.AsSpan());
byte[] original = Brotli.Decompress(stream);