compressors

package
v0.0.0-...-4c19b43 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// ErrInvalidCompressor is returned when an invalid compressor is provided to NewCompressorByExt
	ErrInvalidCompressor = oerrs.String("invalid compressor")

	// ErrRawCompressor is returned when a raw compressor is provided to NewCompressorByExt
	ErrRawCompressor = oerrs.String("raw compressor provided")
)

Variables

This section is empty.

Functions

func NewCompressorByExt

func NewCompressorByExt(ext string) (comp mw.Middleware, err error)

NewCompressorByExt returns a compressor middleware by extension

Types

type Flate

type Flate struct {
	Level int
}

func NewFlate

func NewFlate(level int) Flate

func (Flate) Name

func (Flate) Name() string

func (Flate) Reader

func (Flate) Reader(path string, r io.Reader, _ os.FileInfo) (io.ReadCloser, error)

func (Flate) Writer

func (f Flate) Writer(path string, w io.Writer) (io.WriteCloser, error)

type Gzip

type Gzip struct {
	Level int
}

func NewGzip

func NewGzip(level int) Gzip

func (Gzip) Name

func (Gzip) Name() string

func (Gzip) Reader

func (Gzip) Reader(path string, r io.Reader, _ os.FileInfo) (io.ReadCloser, error)

func (Gzip) Writer

func (f Gzip) Writer(path string, w io.Writer) (io.WriteCloser, error)

type Snappy

type Snappy struct{}

Snappy is for the Google-created snappy compression type

func NewSnappy

func NewSnappy() Snappy

NewSnappy returns a new instance of Snappy

func (Snappy) Name

func (Snappy) Name() string

Name returns the name of the compressor type

func (Snappy) Reader

func (Snappy) Reader(path string, r io.Reader, _ os.FileInfo) (io.ReadCloser, error)

Reader returns a new Snappy reader

func (Snappy) Writer

func (Snappy) Writer(path string, w io.Writer) (io.WriteCloser, error)

Writer returns a new Snappy writer

Jump to

Keyboard shortcuts

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