zlib

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package zlib provides zlib (RFC 1950) capabilities for byte slices.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidHeader = errors.New("zlib: invalid header")

ErrInvalidHeader indicates the input does not begin with a valid zlib wrapper.

Functions

func Decode

func Decode(in []byte) ([]byte, error)

Decode returns the decoded version of the zlib-wrapped byte slice.

func Decompress

func Decompress(b []byte) []byte

Decompress returns decompressed bytes if b is zlib-wrapped, otherwise returns b unchanged.

func Detect

func Detect(in []byte) bool

Detect reports whether in begins with a plausible zlib stream header (RFC 1950 CMF/FLG).

func Encode

func Encode(in []byte) ([]byte, error)

Encode returns the zlib-wrapped version of the byte slice.

func NewDecoder

func NewDecoder(r io.Reader) reader.ReadCloserResetter

NewDecoder returns a resettable read closer for zlib streams.

func NewEncoder

func NewEncoder(w io.Writer, level int) io.WriteCloser

NewEncoder returns a zlib writer; level is passed to compress/zlib.NewWriterLevel (-1 for default).

Types

This section is empty.

Jump to

Keyboard shortcuts

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