compression

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultCompression = gzip.DefaultCompression

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	// Compress compresses the given data.
	Compress(data []byte) ([]byte, error)

	// Decompress decompresses the given data.
	Decompress(data []byte) ([]byte, error)
}

Compressor handles compression and decompression of data. Implementations must be thread-safe.

type GzipCompressor

type GzipCompressor struct {
	Level int
}

GzipCompressor implements the Compressor interface using gzip.

func NewGzipCompressor

func NewGzipCompressor(level int) *GzipCompressor

NewGzipCompressor creates a new GzipCompressor. Default level is gzip.DefaultCompression.

func (*GzipCompressor) Compress

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

Compress compresses the given data using gzip.

func (*GzipCompressor) Decompress

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

Decompress decompresses the given data using gzip.

Jump to

Keyboard shortcuts

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