zstd

package
v1.136.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressLevel

func CompressLevel(dst, src []byte, compressionLevel int) []byte

CompressLevel appends compressed src to dst and returns the result.

The given compressionLevel is used for the compression.

func Decompress

func Decompress(dst, src []byte) ([]byte, error)

Decompress appends decompressed src to dst and returns the result.

This function must be called only for the trusted src. Otherwise use DecompressLimited function.

func DecompressLimited added in v1.110.24

func DecompressLimited(dst, src []byte, maxDataSizeBytes int) ([]byte, error)

Decompress appends decompressed src to dst and returns the result.

If the decompressed result exceeds maxDataSizeBytes, then error is returned.

func PutReader added in v1.102.18

func PutReader(zr *Reader)

PutReader returns zr to the pool, so it could be reused via GetReader.

func PutWriter added in v1.102.18

func PutWriter(zw *Writer)

PutWriter returns zw to the pool, so it could be reused via GetWriter.

Types

type Reader added in v1.102.17

type Reader = gozstd.Reader

Reader is zstd reader

func GetReader added in v1.102.18

func GetReader(r io.Reader) *Reader

GetReader returns Reader for reading zstd-uncompressed data from r.

When the reader is no longer needed, return back it to the pool via PutReader().

func NewReader added in v1.102.17

func NewReader(r io.Reader) *Reader

NewReader returns zstd reader for the given r.

type Writer added in v1.102.17

type Writer = gozstd.Writer

Writer is zstd writer

func GetWriter added in v1.102.18

func GetWriter(w io.Writer, compressLevel int) *Writer

GetWriter returns Writer for writing zstd-compressed data to w.

When the writer is no longer needed, return back it to the pool via PutWriter.

func NewWriterLevel added in v1.102.17

func NewWriterLevel(w io.Writer, level int) *Writer

NewWriterLevel returns zstd writer for the given w and level.

Jump to

Keyboard shortcuts

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