compression

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 6 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 compression abstracts over gzip and zstd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCompression

func GetCompression(opener Opener) (compression.Compression, error)

GetCompression detects whether an Opener is compressed and which algorithm is used.

Types

type Opener

type Opener = func() (io.ReadCloser, error)

Opener represents e.g. opening a file.

type PeekReader

type PeekReader interface {
	io.Reader
	Peek(n int) ([]byte, error)
}

PeekReader is an io.Reader that also implements Peek a la bufio.Reader.

func PeekCompression

func PeekCompression(r io.Reader) (compression.Compression, PeekReader, error)

PeekCompression detects whether the input stream is compressed and which algorithm is used.

If r implements Peek, we will use that directly, otherwise a small number of bytes are buffered to Peek at the gzip/zstd header, and the returned PeekReader can be used as a replacement for the consumed input io.Reader.

Jump to

Keyboard shortcuts

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