compress

package
v0.2.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxDecompressedSize = 64 << 20 // 64 MiB

MaxDecompressedSize caps the output size of a single Decompress call. This protects against zstd decompression bombs: small adversarial inputs that would otherwise expand to arbitrary sizes and OOM the process. 64 MiB is 3-4 orders of magnitude above realistic per-row payload sizes (log bodies, attribute JSON are normally KiB-range).

Variables

This section is empty.

Functions

func Compress

func Compress(data []byte) []byte

Compress compresses the input data using Zstandard.

func Decompress

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

Decompress decompresses the input data using Zstandard. The output is capped at MaxDecompressedSize; larger outputs return an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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