compression

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compress

type Compress struct {
	Type TypeStr
}

Compress holds a compression type and provides methods to compress/decompress data.

func NewCompress

func NewCompress(t TypeStr) *Compress

NewCompress creates a new Compress instance with the specified compression type.

func (*Compress) Compress

func (c *Compress) Compress(data []byte) ([]byte, error)

Compress compresses the input byte slice using the specified compression algorithm.

func (*Compress) Decompress

func (c *Compress) Decompress(data []byte) ([]byte, error)

Decompress decompresses the input byte slice using the specified compression algorithm.

func (*Compress) String

func (c *Compress) String() string

String returns the name of the compression type.

func (*Compress) TypeString

func (c *Compress) TypeString() string

TypeString returns the string representation of the compression type.

type TypeStr

type TypeStr string

TypeStr defines supported compression algorithm names.

const (
	TypeZstd   TypeStr = "zstd"
	TypeGzip   TypeStr = "gzip"
	TypeSnappy TypeStr = "snappy"
	TypeLz4    TypeStr = "lz4"
	TypeBrotli TypeStr = "brotli"
	TypeZlib   TypeStr = "zlib"
	TypeZip    TypeStr = "zip"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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