compress

package
v0.0.0-...-524df1d Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CompressNoCompression      = flate.NoCompression
	CompressBestSpeed          = flate.BestSpeed
	CompressBestCompression    = flate.BestCompression
	CompressDefaultCompression = 6  // flate.DefaultCompression
	CompressHuffmanOnly        = -2 // flate.HuffmanOnly
)

Supported compression levels.

Variables

This section is empty.

Functions

func AcquireFlateReader

func AcquireFlateReader(r io.Reader) (io.ReadCloser, error)

func AcquireGzipReader

func AcquireGzipReader(r io.Reader) (*gzip.Reader, error)

func AcquireStacklessDeflateWriter

func AcquireStacklessDeflateWriter(w io.Writer, level int) stackless.Writer

func AcquireStacklessGzipWriter

func AcquireStacklessGzipWriter(w io.Writer, level int) stackless.Writer

func AppendDeflateBytes

func AppendDeflateBytes(dst, src []byte) []byte

AppendDeflateBytes appends deflated src to dst and returns the resulting dst.

func AppendDeflateBytesLevel

func AppendDeflateBytesLevel(dst, src []byte, level int) []byte

AppendDeflateBytesLevel appends deflated src to dst using the given compression level and returns the resulting dst.

Supported compression levels are:

  • CompressNoCompression
  • CompressBestSpeed
  • CompressBestCompression
  • CompressDefaultCompression
  • CompressHuffmanOnly

func AppendGunzipBytes

func AppendGunzipBytes(dst, src []byte) ([]byte, error)

AppendGunzipBytes appends gunzipped src to dst and returns the resulting dst.

func AppendGzipBytes

func AppendGzipBytes(dst, src []byte) []byte

AppendGzipBytes appends gzipped src to dst and returns the resulting dst.

func AppendGzipBytesLevel

func AppendGzipBytesLevel(dst, src []byte, level int) []byte

AppendGzipBytesLevel appends gzipped src to dst using the given compression level and returns the resulting dst.

Supported compression levels are:

  • CompressNoCompression
  • CompressBestSpeed
  • CompressBestCompression
  • CompressDefaultCompression
  • CompressHuffmanOnly

func AppendInflateBytes

func AppendInflateBytes(dst, src []byte) ([]byte, error)

AppendInflateBytes appends inflated src to dst and returns the resulting dst.

func GunzipData

func GunzipData(p []byte) ([]byte, error)

func InflateData

func InflateData(p []byte) ([]byte, error)

func IsFileCompressible

func IsFileCompressible(f *os.File, minCompressRatio float64) bool

func ReleaseFlateReader

func ReleaseFlateReader(zr io.ReadCloser)

func ReleaseGzipReader

func ReleaseGzipReader(zr *gzip.Reader)

func ReleaseStacklessDeflateWriter

func ReleaseStacklessDeflateWriter(sw stackless.Writer, level int)

func ReleaseStacklessGzipWriter

func ReleaseStacklessGzipWriter(sw stackless.Writer, level int)

func ResetFlateReader

func ResetFlateReader(zr io.ReadCloser, r io.Reader) error

func WriteDeflate

func WriteDeflate(w io.Writer, p []byte) (int, error)

WriteDeflate writes deflated p to w and returns the number of compressed bytes written to w.

func WriteDeflateLevel

func WriteDeflateLevel(w io.Writer, p []byte, level int) (int, error)

WriteDeflateLevel writes deflated p to w using the given compression level and returns the number of compressed bytes written to w.

Supported compression levels are:

  • CompressNoCompression
  • CompressBestSpeed
  • CompressBestCompression
  • CompressDefaultCompression
  • CompressHuffmanOnly

func WriteGunzip

func WriteGunzip(w io.Writer, p []byte) (int, error)

WriteGunzip writes ungzipped p to w and returns the number of uncompressed bytes written to w.

func WriteGzip

func WriteGzip(w io.Writer, p []byte) (int, error)

WriteGzip writes gzipped p to w and returns the number of compressed bytes written to w.

func WriteGzipLevel

func WriteGzipLevel(w io.Writer, p []byte, level int) (int, error)

WriteGzipLevel writes gzipped p to w using the given compression level and returns the number of compressed bytes written to w.

Supported compression levels are:

  • CompressNoCompression
  • CompressBestSpeed
  • CompressBestCompression
  • CompressDefaultCompression
  • CompressHuffmanOnly

func WriteInflate

func WriteInflate(w io.Writer, p []byte) (int, error)

WriteInflate writes inflated p to w and returns the number of uncompressed bytes written to w.

Types

This section is empty.

Jump to

Keyboard shortcuts

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