compression

package
v0.16.6-rc.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWriterNotAcquired = errors.New("using writer after release")

Functions

func Gzip64Decode

func Gzip64Decode(data string) ([]byte, error)

func Gzip64Encode

func Gzip64Encode(data []byte) (string, error)

Types

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is a pooled gzip writer. Its gzip writer is permanently wired to proxy, which forwards writes to the caller's dst while the writer is acquired. The indirection lets Release detach the caller's destination in O(1) instead of paying a second flate reset just to re-point the gzip writer at io.Discard.

func GzipWriter

func GzipWriter(dst io.Writer) *Writer

GzipWriter returns a gzip writer reset onto `dst`, compressing at the default level. Once used, it should be sent back to the pool via `Release`

func GzipWriterLevel

func GzipWriterLevel(dst io.Writer, level int) *Writer

GzipWriterLevel returns a gzip writer reset onto `dst`, compressing at `level`. Once used, it should be sent back to the pool via `Release`

func (*Writer) Close

func (w *Writer) Close() error

func (*Writer) Flush

func (w *Writer) Flush() error

func (*Writer) Release

func (w *Writer) Release()

Release returns the writer to the pool

func (*Writer) Write

func (w *Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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