NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
pub.dev
pub.dev, #4086 most downloaded on pub.dev
Pure Dart implementations of LZ4, Snappy, GZIP, raw DEFLATE, and Zstd compression algorithms with no native dependencies.
Latest stable
2.1.0
Last release 20 days ago
02 Nov 2026
Ships on a steady schedule
a new release about every 5 months
Nearly every release is documented
notes for 7 of 7 stable releases
Nothing withdrawn
no release was ever pulled
10 months old
7 releases · first in 2026
Drag across the ruler to compare, or tap a release to open it.
`DeflateCodec`: raw DEFLATE (RFC 1951), with no GZIP header or trailer, as ZIP entries hold it. Levels 1-9, maxSize, and decompress(data, size: n) as
DeflateCodec: raw DEFLATE (RFC 1951), with no GZIP header or trailer, as ZIP entries hold it. Levels 1-9,
maxSize, and decompress(data, size: n) as the other codecs have them, and DeflateOptions for fromOptions.
Bytes after the final block are rejected. It is a block codec only, so it has no CodecType.A breaking release: one consistent public API, Parquet's legacy LZ4 codec, and correctness fixes found by differential fuzzing against the zstd, lz4,
A breaking release: one consistent public API, Parquet's legacy LZ4 codec, and correctness fixes found by
differential fuzzing against the zstd, lz4, gzip and snzip tools.
| 1.x | 2.0.0 |
|---|---|
maxDecompressedSize: (LZ4, GZIP, Zstd, CodecFactory.codec) |
maxSize: |
enableContentChecksum: (LZ4), enableChecksum: (Zstd) |
checksum: |
CodecFactory.defaultMaxDecompressedSize |
CodecFactory.defaultMaxSize |
Lz4Codec().compressBlock(data) / decompressBlock(data, maxSize: n) |
Lz4Codec(format: Lz4Format.raw).compress(data) / Lz4Codec(format: Lz4Format.raw, maxSize: n).decompress(data) |
SnappyCodec(framing: true) / SnappyOptions(framing: true) |
SnappyCodec(format: SnappyFormat.framed) / SnappyOptions(format: SnappyFormat.framed) |
codec.supports(CodecMode.stream), CodecFactory.supports(...) |
Removed: every codec supports block and stream use |
CompressionLevel |
Removed |
on Lz4FormatException etc. for a size-limit breach |
on LimitException (still a CompressionFormatException) |
guardFormat, validate*, zstd_common.dart (frame/block header types, magic numbers), SnappyIncrementalDecoder, top-level defaultMaxBufferSize and per-codec default constants |
No longer exported |
Implementing or extending CompressionCodec / CompressionStreamCodec freely |
The bases are abstract base class (extend only); the concrete codecs are final |
| GZIP header MTIME was the current time | MTIME defaults to 0 (reproducible output); pass mtime: |
| Empty input decoded to empty output (LZ4; GZIP/Zstd streams) | Empty input is an error for every codec except noop |
CLI overwrote outputs, printed status and errors to stdout, exited 1 on --help |
See CLI below |
CodecType.parse('GZIP') threw |
Case is ignored, so CodecType.parse(codec.name) works |
Options classes accepted invalid block sizes, chunk sizes and MTIME until fromOptions |
They throw ArgumentError when constructed |
decompress(data, size: n) on every codec: decoding stops once output would exceed n, and output of any
other length is rejected. Intended for Parquet pages, whose uncompressed size is known.Lz4Format.hadoop: Hadoop block framing, Parquet's legacy LZ4 codec. Written as Arrow does (one block, one
chunk); several blocks and chunks are decoded, each chunk on its own. Tested on pages written by parquet-mr
(LZ4) and parquet-cpp (LZ4_RAW, and older LZ4 pages written as bare blocks, which decode with
Lz4Format.raw), from apache/parquet-testing.Lz4Format/SnappyFormat enums select the format of Lz4Codec and SnappyCodec.LimitException, with the limit that was exceeded: the configured cap, not the budget left in a stream.DeflateFormatException is a GzipFormatException, so GZIP callers catch DEFLATE errors too.mtime on GzipCodec, GzipOptions and GzipStreamCodec.ZstdOptions.strict and ZstdOptions.onFallback, carried by ZstdCodec.fromOptions.fromOptions on every stream codec (Lz4StreamCodec, SnappyStreamCodec, GzipStreamCodec,
ZstdStreamCodec).GzipStreamCodec filename and comment, as on GzipCodec; a NUL in either is rejected.NoopFormatException: NoopCodec.decompress(data, size: n) with fewer than n bytes.maxSize, including when created through CodecFactory.-f is required to overwrite, and the input is never used as the output;- means stdin/stdout;--raw and --hadoop formats;--level N (1-22 for Zstd);--help exits 0, and usage errors exit 2.Measured with benchmark/codec_benchmark.dart (MB/s of uncompressed data, Dart VM, before -> after; tasks/ holds
the full tables):
| Path | Before | After |
|---|---|---|
LZ4 raw decode with size: (house.jpg / geo.protodata / world192) |
11900 / 1720 / 354 | 22170 / 4367 / 643 |
| LZ4 raw compress, 1 KB page | 14 | 290 |
| LZ4 frame compress, 1 KB page | 4.5 | 280 |
| LZ4 frame decode without a content size (1 KB / 8 KB / 64 KB page) | 7 / 49 / 206 | 522 / 498 / 424 |
| Snappy raw decode (world192 / geo.protodata) | 436 / 2566 | about 700 / 3306 |
| Snappy framed decode (geo.protodata), with slice-by-8 CRC32C | 300 | 1027 |
| GZIP decode (bible.txt) | 167 | about 310 |
| GZIP decode, 20,000 dynamic blocks with 15-bit codes | 17x zlib | under 3x zlib |
| Zstd decode (world192 / bible / geo.protodata) | 127 / 125 / 557 | 314 / 310 / 2091 |
| Zstd streaming decode, 8 MB window (one-shot is itself 2x faster) | 49-53% of one-shot | about 80% of one-shot |
| Zstd compress, 1 KB page | 1.0 | 32 |
| Zstd compress (world192 / bible.txt / geo.protodata) | 20 / 15 / 35 | 41 / 30 / 99 |
| XXH64 on the web (4 MB checksum, node) | 447 ms | 47 ms |
| LZ4 stream compress, world192 in 1 KB chunks | 813 ms | 21 ms |
| Snappy compress (world192 / house.jpg / 1 MB random) | 199 / 140 / 128 | 223 / 5088 / 2569 |
Small results no longer pin large buffers: compressing 1 MB of zeros with LZ4 returned 4 KB that kept a 1 MB allocation alive.
| Codec | Change | Before | After |
|---|---|---|---|
| LZ4 level 9 (world192 / geo.protodata) | Every position in the hash chain, lazy matching, offset 65535 | 967667 / 17209 | 801190 / 15567 (lz4 -9: 787449 / 15388) |
| LZ4 levels 2-8 | High-compression mode with chain depth 2^(level-1); they were the same as level 1 |
1069746 (world192) | 919699 (level 2) to 803489 (level 8) |
Lz4StreamCodec level 9 (world192, 64 KB chunks) |
The level is honoured; it was ignored | 1052323 | 801572 |
| GZIP levels 1 / 6 / 9 (world192) | zlib's per-level match settings, matches across blocks, dynamic Huffman at every level (GzipCodec and GzipStreamCodec) |
977124 / 814410 / 819236 | 902962 / 718924 / 715887 (gzip: 903087 / 719196 / 716191) |
| GZIP levels 1 / 6 / 9 (bible.txt) | As above | 1560329 / 1279319 / 1289738 | 1491469 / 1192107 / 1177455 (gzip: 1491084 / 1191907 / 1177372) |
| Snappy framed (geo.protodata / world192) | The reference encoder loop: skips ahead on misses, chains copies, splits long copies 64/60 | 27581 / 1249348 | 23354 / 1224693 (snzip: 23169 / 1198914) |
| GZIP, 1 MB of random bytes | Each block is written stored, fixed or dynamic, whichever is smallest | 1050123 (level 1) | 1048677 (+0.01%) |
Lz4StreamCodec buffers input into whole blocks of blockSize, so its output no longer depends on how the input is
chunked, and a block is emitted only once blockSize bytes are pending (or at the end). GzipStreamCodec does the
same with 64 KB DEFLATE blocks: 300-byte chunks of bible.txt were 13% larger and 6x slower than one chunk, and are
now identical; a single 32 MB chunk no longer builds tokens for the whole chunk at once.
maxSize was used up exactly could still decode up to 1 KB.lz4 rejects them).SnappyFormatException, and an uncompressed chunk over maxSize raised
SnappyFormatException instead of LimitException.maxSize could be exceeded by literals near the end of the input; a NUL in filename or comment
wrote an unreadable header and is now rejected.RangeError/IndexError; an empty RLE literals section was rejected although valid; a compressed block without
its sequence count was accepted; the streaming decoder buffered whole skippable frames.zstd -d decodes it without --memory.Your coding agent can read these notes before it upgrades. Set up the MCP server →
Release 1.3.0: Zstd/GZIP correctness fixes, faster GZIP and Zstd deco…
Release 1.3.0: Zstd/GZIP correctness fixes, faster GZIP and Zstd deco…
Crc32.combine, which returned incorrect values.maxSize breach as "Decompressed size exceeds maximum" instead of "Incomplete GZIP member at end of stream", and stops buffering input once the limit is hit.BigInt (decoding a checksummed frame: 25 -> 183 MB/s on bible.txt, AOT). JavaScript targets keep the BigInt implementation.crc32: Expose crc32.dart via the public API.
crc32.dart via the public API.LZ4: Lz4Codec.compressBlock/decompressBlock expose the raw LZ4 block format (the bare LZ77 token stream, no frame header/checksum) for containers that
Lz4Codec.compressBlock/decompressBlock expose the raw LZ4 block format (the bare LZ77 token stream, no frame header/checksum) for containers that supply their own framing.Better streaming and more deterministic behavior
Initial release with pure Dart compression implementations (no native dependencies; runs on the Dart VM and dart2js/web)
CompressionStreamCodec, with backpressure and an optional verified (all-or-nothing) mode that withholds output until checksums validateCompressionCodec; CodecFactory.codec/streaming accept maxDecompressedSize/maxBufferSize/verified for central limit enforcementmaxDecompressedSize (cumulative across frames/members); streaming decode is incremental and memory-boundedonFallback hook, and opt-in strict modelibcompress) for all codecs, with atomic output (temp file + rename, cleanup on error) and an opt-in --verified flagOne column per month.