es_compression
2.0.16, released 3 weeks ago by instantiations.com
Compression framework providing FFI implementations for Brotli, Lz4, and Zstd.
What it does
Provides a compression framework in Dart with FFI implementations for Brotli, Lz4, and Zstd (Zstandard), along with ready-to-use prebuilt binaries for Windows, Linux, and macOS. It also includes an executable tool 'escompress' for command-line file compression.
AI-written summary of version 2.0.16, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need Brotli, Lz4, or Zstd compression algorithms in your Dart or Flutter application.
- You want FFI-based performance for compression tasks on desktop or mobile platforms.
- You need a command-line tool to encode/decode compressed files.
Skip it when
- You are running heavily on the web where native FFI shared libraries are unavailable and require pure Dart solutions.
- You only require basic GZip compression which is already built into the standard Dart SDK (`dart:io`).
Strengths
- Supports multiple efficient compression algorithms (Brotli, Lz4, Zstd).
- Comes with ready-to-use prebuilt binaries for major desktop and mobile environments.
- Flexible library loader supporting custom paths and environment variables.
Weaknesses
- Requires managing and bundling native shared libraries (.dll, .so, .dylib) for target platforms.
- Mac OS binaries require manual security allowance unless signed.
Setup
- Kind
- FFI (native library)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 4
FFI-based implementations require access to native shared libraries (.dll, .so, .dylib). Android projects require placing prebuilt .so files in jniLibs and updating build.gradle.
import 'dart:convert';
import 'package:es_compression/brotli.dart';
import 'package:es_compression/lz4.dart';
import 'package:es_compression/zstd.dart';
void main() {
final bytes = utf8.encode('Hello Dart');
for (final codec in [brotli, lz4, zstd]) {
final encoded = codec.encode(bytes);
final decoded = codec.decode(encoded);
print(utf8.decode(decoded));
}
}Alternatives
Packages that do the same job and could replace es_compression.
- zstandard
Flutter plugin for fast Zstandard compression and decompression across native and WebAssembly.
82Compare - gzip
A lightweight package for gzip compression and decompression.
50Compare - brotli
Pure Dart Brotli decoder
50Compare - flutter_olm
Builds the native Olm library for Android and iOS to be used via dart:ffi.
40Compare
Works with
Packages commonly used together with es_compression: ones it builds on, ones built on it, and its own family.
- stack_tracees_compression depends on itProvides parsing, inspection, and readable formatting of Dart stack traces.
- ffies_compression depends on itUtilities for working with Foreign Function Interface (FFI) code in Dart.
- argses_compression depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- stream_channeles_compression depends on itAn abstraction for two-way communication channels based on the Dart Stream class.