brotli

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT, MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package brotli implements the Brotli reader and writer needed by external formats: WOFF2 decoding and the WeChat WASM artifact. Resource .dat packages intentionally do not use this codec.

The implementation is derived from github.com/andybalholm/brotli v1.2.1. HTTP helpers and the experimental matchfinder encoder are intentionally excluded so runtime builds do not acquire an unrelated net/http dependency.

Index

Constants

View Source
const BestCompression = 11

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

func NewReader

func NewReader(src io.Reader) *Reader

NewReader creates a new Reader reading the given reader.

func (*Reader) Read

func (r *Reader) Read(p []byte) (n int, err error)

func (*Reader) Reset

func (r *Reader) Reset(src io.Reader)

Reset discards the Reader's state and makes it equivalent to the result of its original state from NewReader, but reading from src instead. This permits reusing a Reader rather than allocating a new one.

type Writer

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

func NewWriterLevel

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

NewWriterLevel compresses data written to dst at a quality level from 0 to 11. Call Close to finish the stream.

func (*Writer) Close

func (w *Writer) Close() error

Close flushes remaining data to the decorated writer.

func (*Writer) Write

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

Write buffers or compresses p. Close writes the final block.

Jump to

Keyboard shortcuts

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