Help us shape the future of Go! Take the 2026 Go Developer Survey

compress

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

View Source
const ZSTD_LEVEL = 1 // fastest

ZSTD_LEVEL compression level used by Zstd

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	Name() string
	CompressBound(int) int
	Compress(dst, src []byte) (int, error)
	Decompress(dst, src []byte) (int, error)
}

Compressor interface to be implemented by a compression algo

func NewCompressor

func NewCompressor(algr string) Compressor

NewCompressor returns a struct implementing Compressor interface

type LZ4

type LZ4 struct{}

LZ4 implements Compressor using LZ4 library

func (LZ4) Compress

func (l LZ4) Compress(dst, src []byte) (int, error)

Compress using LZ4 algorithm

func (LZ4) CompressBound

func (l LZ4) CompressBound(size int) int

CompressBound max size of compressed data

func (LZ4) Decompress

func (l LZ4) Decompress(dst, src []byte) (int, error)

Decompress using LZ4 algorithm

func (LZ4) Name

func (l LZ4) Name() string

Name returns name of the algorithm LZ4

type ZStandard

type ZStandard struct {
	// contains filtered or unexported fields
}

ZStandard implements Compressor interface using zstd library

func (ZStandard) Compress

func (n ZStandard) Compress(dst, src []byte) (int, error)

Compress using Zstd

func (ZStandard) CompressBound

func (n ZStandard) CompressBound(l int) int

CompressBound max size of compressed data

func (ZStandard) Decompress

func (n ZStandard) Decompress(dst, src []byte) (int, error)

Decompress using Zstd

func (ZStandard) Name

func (n ZStandard) Name() string

Name returns name of the algorithm Zstd

Jump to

Keyboard shortcuts

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