1
0
Fork 0
mirror of https://github.com/fluxerapp/zstd_dart.git synced 2026-07-11 03:17:50 +00:00
No description
Find a file
2026-05-20 23:11:39 +02:00
hook feat: add native build hook for zstd compilation 2026-03-21 10:30:21 +01:00
lib feat: implement ZstdCodec compress and decompress 2026-03-21 10:30:52 +01:00
test test: add zstd compress/decompress tests 2026-03-21 10:30:24 +01:00
third_party feat: add facebook/zstd v1.5.7 as git submodule 2026-03-21 10:23:14 +01:00
.gitignore chore: add .gitignore, remove .dart_tool from tracking 2026-03-21 10:22:13 +01:00
.gitmodules feat: add facebook/zstd v1.5.7 as git submodule 2026-03-21 10:23:14 +01:00
.pubignore chore: add CHANGELOG 2026-05-20 23:02:12 +02:00
analysis_options.yaml feat: initial package scaffold 2026-03-21 10:22:07 +01:00
CHANGELOG.md chore: add CHANGELOG 2026-05-20 23:02:12 +02:00
LICENSE Create LICENSE 2026-05-20 23:11:39 +02:00
pubspec.lock feat: initial package scaffold 2026-03-21 10:22:07 +01:00
pubspec.yaml feat: initial package scaffold 2026-03-21 10:22:07 +01:00
README.md docs: add brief README with usage and build info 2026-03-21 10:46:12 +01:00

zstd_dart

Zstd compression and decompression for Dart, using native build hooks to compile the zstd C library at build time via package:native_toolchain_c.

Usage

import 'dart:typed_data';
import 'package:zstd_dart/zstd_dart.dart';

// Compress
final input = Uint8List.fromList([1, 2, 3, 4, 5]);
final compressed = ZstdCodec.compress(input);

// Decompress
final decompressed = ZstdCodec.decompress(compressed);

// Custom compression level (1-22, default 3)
final highCompression = ZstdCodec.compress(input, level: 19);

How it works

The package uses Dart's native build hooks (package:hooks) to compile zstd C sources from third_party/zstd/ into a shared library at build time. FFI bindings in lib/src/zstd_bindings.dart use @Native annotations to link to the compiled library automatically.

Requirements

  • Dart SDK >=3.10.0
  • A C compiler available on the build host (provided by the Dart/Flutter toolchain)