compress

package
v1.3.17 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Zlib Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ZstdLevel = 1 // fastest

ZstdLevel compression level used by Zstd

Variables

This section is empty.

Functions

func IsZip

func IsZip(zipPath string) bool

func UNZipFile

func UNZipFile(archive, target string) error

func ZipFile

func ZipFile(srcPath, destPath string) error

Types

type Compressor

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

func NewCompressor

func NewCompressor(level string) Compressor

type LZ4

type LZ4 struct{}

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