zstd

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package zstd implements RFC 8878 zstd frames for NYA. House encoder/decoder — studied klauspost/compress and libzstd; this code is in-house.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecompressZstd

func DecompressZstd(data []byte) ([]byte, error)

DecompressZstd decompresses Zstandard compressed data (RFC 8878).

func DecompressZstdLegacy

func DecompressZstdLegacy(data []byte) ([]byte, error)

DecompressZstdLegacy decompresses pre-v1.1 zstd frames (NYA minor version 0).

func DecompressZstdWithDict

func DecompressZstdWithDict(data, dict []byte) ([]byte, error)

DecompressZstdWithDict decompresses a frame that was encoded with ZstdCompressWithDict using the same dictionary bytes. The dict is a match-window prefix only — it is not part of the returned content.

func ZstdCompress

func ZstdCompress(src []byte, level int) []byte

ZstdCompress compresses data using Zstandard format (RFC 8878). level: 1 (fastest) to 19 (best compression). Default 3 if 0.

func ZstdCompressWithDict

func ZstdCompressWithDict(src []byte, level int, dict []byte) []byte

ZstdCompressWithDict compresses with a dictionary prefix. The dict bytes are prepended to the match-finding window so the encoder can reference them, but only src bytes appear in the output frame.

func ZstdCompressWithWindow

func ZstdCompressWithWindow(src []byte, level int) []byte

ZstdCompressWithWindow compresses data using inter-block windowed matching. Blocks within the frame can reference data from previous blocks via a sliding window, improving compression for data with cross-block repetition.

func ZstdDecompress

func ZstdDecompress(data []byte) ([]byte, error)

ZstdDecompress decompresses Zstandard compressed data.

func ZstdNewReader

func ZstdNewReader(r io.Reader) (io.ReadCloser, error)

ZstdNewReader returns an io.ReadCloser that decompresses RFC 8878 zstd data from r.

func ZstdNewReaderLegacy

func ZstdNewReaderLegacy(r io.Reader) (io.ReadCloser, error)

ZstdNewReaderLegacy decompresses frames from NYA v1.0 archives (minor version 0). See zstd_legacy.go.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL