brotli

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireBuffer

func AcquireBuffer() *bytes.Buffer

AcquireBuffer returns a pooled *bytes.Buffer with length 0.

func AcquireWriter

func AcquireWriter(w io.Writer) *brotli.Writer

AcquireWriter returns a pooled *brotli.Writer reset to write into w.

func Encode

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

Encode compresses p and returns a standalone []byte. This is convenient but performs one allocation to detach from the pooled buffer.

func EncodeToBuffer

func EncodeToBuffer(p []byte) (*bytes.Buffer, error)

EncodeToBuffer compresses p and returns a pooled buffer holding the result. The caller must call ReleaseBuffer on the returned buffer when done. No copy is made; safest for performance-critical paths where the caller controls lifetimes.

func EncodeToWriter

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

EncodeToWriter compresses p and writes the result to w using a pooled writer. This path avoids allocations in hot code paths.

func ReleaseBuffer

func ReleaseBuffer(buf *bytes.Buffer)

ReleaseBuffer returns the buffer to the pool.

func ReleaseWriter

func ReleaseWriter(bw *brotli.Writer) error

ReleaseWriter closes the writer (flushing final block) and returns it to the pool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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