compress

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAvailable = errors.New("Compression type is unavailable (not linked into the binary)")
)

Common errors.

Functions

func Register

func Register(t Type, rf func(io.Reader) (io.ReadCloser, error), wf func(io.Writer) (io.WriteCloser, error))

Register registers the given compression type. Intended to be called from the compression type's init method.

Types

type Type

type Type uint8

Type indicates the compression format, as implemented in another package.

const (
	None   Type = iota
	Snappy      // import _ "bitbucket.org/pcastools/compress/snappy"
	Gzip        // import _ "bitbucket.org/pcastools/compress/gzip"
	Zlib        // import _ "bitbucket.org/pcastools/compress/zlib"
	Zstd        // import _ "bitbucket.org/pcastools/compress/zstd"
	S2          // import _ "bitbucket.org/pcastools/compress/s2"

)

The supported compression formats.

func (Type) Available

func (t Type) Available() bool

Available reports whether the given compression type is linked into the binary.

func (Type) NewReader

func (t Type) NewReader(r io.Reader) (io.ReadCloser, error)

NewReader creates a new reader for this compression type, reading from the given io.Reader r. It is the caller's responsibility to call Close on the reader when done.

func (Type) NewWriter

func (t Type) NewWriter(w io.Writer) (io.WriteCloser, error)

NewWriter creates a new writer for this compression type. Writes to the returned writer will be compressed and written to w. It is the caller's responsibility to call Close on the writer when done.

func (Type) String

func (t Type) String() string

String returns a string description of this compression type.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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