Request: Add dart_lz4 Dart binding to the LZ4 bindings list
Request: Add dart_lz4 Dart binding to the LZ4 bindings list
The LZ4 website lists language bindings for various platforms. Currently, the only Dart binding listed is es_compression, which uses FFI/native code and does not support Web targets.
I'd like to request adding dart_lz4 — a pure Dart LZ4 implementation that complements es_compression by providing Web-safe, dependency-free LZ4 compression.
Package details
- Name:
dart_lz4 - Pub.dev: https://pub.dev/packages/dart_lz4
- Repository: https://github.com/jxoesneon/dart_lz4
- License: Apache-2.0
- Version: 1.3.0
- Pub.dev score: 160/160
- OpenSSF Best Practices: Gold badge (https://www.bestpractices.dev/projects/14608)
Features
- Pure Dart implementation (no FFI, no native code)
- Web-safe (no
dart:ioin library code, works on WASM) - LZ4 block encode/decode
- LZ4 frame encode/decode (current format, legacy format, skippable frames)
- LZ4HC high-compression mode (levels 1-12)
- Streaming frame encode/decode via
StreamTransformer - Dictionary support (encode + decode)
- 64-bit content size support
- xxHash32 with VM + Web parity
- Zero-copy decompression API
- Buffer pool architecture for zero-allocation streaming
dart:convertCodec wrapper for ecosystem composition
Interoperability
Tested against the reference lz4 CLI (lz4 v1.10.0) via embedded decode vectors and CLI decode tests. Produces valid LZ4 frames that the reference CLI can decode.
Differentiation from es_compression
| Feature | dart_lz4 |
es_compression |
|---|---|---|
| Pure Dart | Yes | No (FFI) |
| Web support | Yes | No |
| WASM | Yes | No |
| Runtime deps | 0 | Native LZ4 |
| Frame format | Current + legacy + skippable | Current |
| HC mode | Yes (levels 1-12) | No |
| Streaming | Yes (StreamTransformer) | Limited |
Why list it?
dart_lz4 fills the gap for Dart developers who need LZ4 compression on Web/WASM targets where FFI is unavailable. It is feature-complete, security-hardened (OpenSSF Gold, fuzzing, bounds-safe decoding), and interoperable with the reference implementation.
Thank you for considering this request.
Source: lz4/lz4