betto_zstd library

Zstd compression and decompression for Dart.

This library provides a high-level API for using the Zstandard (Zstd) compression algorithm in Dart applications. It supports synchronous compression and decompression on native platforms (via FFI) and on the web (via an Emscripten-compiled WASM module).

On web, call ZstdSimple.init and await it before using any ZstdSimple instance. On native platforms ZstdSimple.init is a no-op.

Compression and decompression are both single-shot: the entire input and output live in memory for the duration of the call. Streaming (bounded chunked processing regardless of declared frame size) is not offered. Because decompress must allocate its output buffer up front, sized by the declared content size in the frame header, it is bounded by maxOutputBytes (see ZstdSimple.decompress) rather than left unbounded.

Classes

ZstdSimple
Stub implementation of ZstdSimple for unsupported platforms.

Constants

defaultMaxOutputBytes → const int
The default upper bound, in bytes, on the buffer ZstdSimple.decompress will allocate for a frame's declared decompressed size.

Functions

maxCLevel() int
Returns the maximum compression level.
minCLevel() int
Returns the minimum compression level.

Exceptions / Errors

ZstdException
Thrown when the Zstd library reports a compression or decompression error, or when the frame header is invalid or missing content size information.
ZstdLimitExceededException
Thrown by decompress when a frame's declared decompressed size exceeds the caller's maxOutputBytes limit.