compression

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

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

Compressor is a squashfs decompressor interface. Allows for easy compression.

type Decompressor

type Decompressor interface {
	Decompress(io.Reader) ([]byte, error)
}

Decompressor is a squashfs decompressor interface. Allows for easy decompression no matter the type of compression.

type Gzip

type Gzip struct {
	HasCustomWindow bool
	HasStrategies   bool
	// contains filtered or unexported fields
}

Gzip is a decompressor for gzip type compression. Uses zlib for compression and decompression

func NewGzipCompressorWithOptions

func NewGzipCompressorWithOptions(r io.Reader) (*Gzip, error)

NewGzipCompressorWithOptions creates a new gzip compressor/decompressor with options read from the given reader.

func (*Gzip) Compress

func (g *Gzip) Compress(data []byte) ([]byte, error)

Compress compresses the given data (as a byte array) and returns the compressed data.

func (*Gzip) Decompress

func (g *Gzip) Decompress(r io.Reader) ([]byte, error)

Decompress reads the entirety of the given reader and returns it uncompressed as a byte slice.

type Lz4

type Lz4 struct {
	HC bool
}

Lz4 is a Lz4 Compressor/Decompressor

func NewLz4CompressorWithOptions

func NewLz4CompressorWithOptions(r io.Reader) (*Lz4, error)

NewLz4CompressorWithOptions creates a new lz4 compressor/decompressor with options read from the given reader.

func (*Lz4) Compress

func (l *Lz4) Compress(data []byte) ([]byte, error)

Compress implements compression.Compress

func (*Lz4) Decompress

func (l *Lz4) Decompress(r io.Reader) ([]byte, error)

Decompress decompresses all data from r and returns the uncompressed bytes

type Lzma

type Lzma struct{}

Lzma is a lzma decompressor

func (*Lzma) Compress

func (l *Lzma) Compress(data []byte) ([]byte, error)

Compress implements compression.Compress

func (*Lzma) Decompress

func (l *Lzma) Decompress(rdr io.Reader) ([]byte, error)

Decompress decompresses all the data in the given reader and returns the uncompressed bytes.

type Xz

type Xz struct {
	DictionarySize int32
	HasFilters     bool
}

Xz is a Xz decompressor.

func NewXzCompressorWithOptions

func NewXzCompressorWithOptions(rdr io.Reader) (*Xz, error)

NewXzCompressorWithOptions creates a new Xz compressor/decompressor that reads the compressor options from the given reader.

func (*Xz) Compress

func (x *Xz) Compress(data []byte) ([]byte, error)

Compress implements compression.Compress

func (*Xz) Decompress

func (x *Xz) Decompress(rdr io.Reader) ([]byte, error)

Decompress decompresses all the data from the rdr and returns the uncompressed bytes.

type Zstd

type Zstd struct {
	CompressionLevel int32
}

Zstd is a zstd compressor/decompressor

func NewZstdCompressorWithOptions

func NewZstdCompressorWithOptions(r io.Reader) (*Zstd, error)

NewZstdCompressorWithOptions creates a new Zstd with options read from the given reader

func (*Zstd) Compress

func (z *Zstd) Compress(data []byte) ([]byte, error)

Compress impelements compression.Compress

func (*Zstd) Decompress

func (z *Zstd) Decompress(r io.Reader) ([]byte, error)

Decompress decompresses all data from the reader and returns the uncompressed data

Jump to

Keyboard shortcuts

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