zstandard 1.3.20 zstandard: ^1.3.20 copied to clipboard
Flutter plugin to implement Zstandard compression
Zstandard #
Zstandard (zstd) is a fast, high-compression algorithm developed by Meta (formerly Facebook) designed for real-time compression scenarios. It provides a flexible range of compression levels, allowing both high-speed and high-ratio compression, making it ideal for applications with diverse performance needs. Zstandard is commonly used in data storage, transmission, and backup solutions.
This is a Flutter plugin that provides a pure implementation of the zstd compression algorithm, developed by Meta. It integrates the zstd library in C through FFI for native platforms, ensuring efficient compression and decompression. For web platforms, it leverages WebAssembly to deliver the same robust compression capabilities. This plugin enables seamless, cross-platform data compression, making it ideal for applications requiring high-speed and efficient data processing.
Android | iOS | Web | macOS | Windows | Linux | Fuchsia | |
---|---|---|---|---|---|---|---|
Status | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ |
Native | FFI | FFI | WebAssembly | FFI | FFI | FFI | ❌ |
Precompiled | No | No | Yes (wasm) | No | No | No | ❌ |
The C files to build the compression library come from the original facebook/zstd repository.
Usage #
void act() async {
final zstandard = Zstandard();
Uint8List original = Uint8List.fromList([...]);
Uint8List? compressed = await zstandard.compress(original);
Uint8List? decompressed = await zstandard.decompress(compressed ?? Uint8List(0));
}
With extension functions:
void act() async {
Uint8List original = Uint8List.fromList([...]);
Uint8List? compressed = await original.compress();
Uint8List? decompressed = await compressed.decompress();
}