go1.20.5
GoThrough

zlib.BestCompression

// These constants are copied from the flate package, so that code that imports // "compress/zlib" does not also have to import "compress/flate". const BestCompression = flate.BestCompression

zlib.BestSpeed

// These constants are copied from the flate package, so that code that imports // "compress/zlib" does not also have to import "compress/flate". const BestSpeed = flate.BestSpeed

zlib.DefaultCompression

// These constants are copied from the flate package, so that code that imports // "compress/zlib" does not also have to import "compress/flate". const DefaultCompression = flate.DefaultCompression

zlib.HuffmanOnly

// These constants are copied from the flate package, so that code that imports // "compress/zlib" does not also have to import "compress/flate". const HuffmanOnly = flate.HuffmanOnly

zlib.NoCompression

// These constants are copied from the flate package, so that code that imports // "compress/zlib" does not also have to import "compress/flate". const NoCompression = flate.NoCompression

zlib.ErrChecksum

// ErrChecksum is returned when reading ZLIB data that has an invalid checksum. var ErrChecksum = errors.New("zlib: invalid checksum")

zlib.ErrDictionary

// ErrDictionary is returned when reading ZLIB data that has an invalid dictionary. var ErrDictionary = errors.New("zlib: invalid dictionary")

zlib.ErrHeader

// ErrHeader is returned when reading ZLIB data that has an invalid header. var ErrHeader = errors.New("zlib: invalid header")

zlib.Resetter

// Resetter resets a ReadCloser returned by NewReader or NewReaderDict // to switch to a new underlying Reader. This permits reusing a ReadCloser // instead of allocating a new one. type Resetter interface { // Reset discards any buffered data and resets the Resetter as if it was // newly initialized with the given reader. Reset(r io.Reader, dict []byte) error }

zlib.NewReader

// NewReader creates a new ReadCloser. // Reads from the returned ReadCloser read and decompress data from r. // If r does not implement io.ByteReader, the decompressor may read more // data than necessary from r. // It is the caller's responsibility to call Close on the ReadCloser when done. // // The ReadCloser returned by NewReader also implements Resetter. func NewReader(r io.Reader) (io.ReadCloser, error)

zlib.NewReaderDict

// NewReaderDict is like NewReader but uses a preset dictionary. // NewReaderDict ignores the dictionary if the compressed data does not refer to it. // If the compressed data refers to a different dictionary, NewReaderDict returns ErrDictionary. // // The ReadCloser returned by NewReaderDict also implements Resetter. func NewReaderDict(r io.Reader, dict []byte) (io.ReadCloser, error)

zlib.NewWriter

// NewWriter creates a new Writer. // Writes to the returned Writer are compressed and written to w. // // It is the caller's responsibility to call Close on the Writer when done. // Writes may be buffered and not flushed until Close. func NewWriter(w io.Writer) *Writer

zlib.NewWriterLevel

// NewWriterLevel is like NewWriter but specifies the compression level instead // of assuming DefaultCompression. // // The compression level can be DefaultCompression, NoCompression, HuffmanOnly // or any integer value between BestSpeed and BestCompression inclusive. // The error returned will be nil if the level is valid. func NewWriterLevel(w io.Writer, level int) (*Writer, error)

zlib.NewWriterLevelDict

// NewWriterLevelDict is like NewWriterLevel but specifies a dictionary to // compress with. // // The dictionary may be nil. If not, its contents should not be modified until // the Writer is closed. func NewWriterLevelDict(w io.Writer, level int, dict []byte) (*Writer, error)