compress

package
v1.10.15 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package compress is responsible for compression data.

Index

Constants

View Source
const (
	FormatNoop = Format("noop")
	FormatGZip = Format("gzip")
	FormatZSTD = Format("zstd")
)

Format is the format of compression that happens.

Variables

This section is empty.

Functions

func Compress

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

Compress will compress any given array of bytes.

func Init

func Init(conf *Config) error

Init will initialise global compression instance.

Types

type Compression

type Compression interface {
	Compress([]byte) ([]byte, error)
}

Compression will compress any given array of bytes.

func New

func New(conf *Config) (Compression, error)

New creates an instance of Compression. Based on the Format value, it creates corresponding instance.

type Config

type Config struct {
	Format Format
	Level  int
}

Config holds configurations need for creating a new Compress instance.

type Format

type Format string

Format is the format of compression that happens.

Directories

Path Synopsis
Package gzip is an implementation of Compression interface using gzip format.
Package gzip is an implementation of Compression interface using gzip format.
Package noop is an implementation of Compression interface that doesn't compress data.
Package noop is an implementation of Compression interface that doesn't compress data.
Package zstd is an implementation of Compression interface using zstd format.
Package zstd is an implementation of Compression interface using zstd format.

Jump to

Keyboard shortcuts

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