zreader

package
v1.5.30 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package zreader implements a transparently decompressing io.Reader.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reader

func Reader(r io.Reader) (rc io.ReadCloser, err error)

Reader returns an io.ReadCloser that transparently reads bytes compressed with one of the following schemes:

  • gzip
  • zstd
  • bzip2

If the data does not seem to be one of these schemes, a new io.ReadCloser equivalent to the provided io.Reader is returned. The provided io.Reader is expected to have any necessary cleanup arranged by the caller; that is, it will not arrange for a Close method to be called if it also implements io.Closer.

Types

type Compression

type Compression int

Compression marks the scheme that the original Reader contains.

const (
	KindGzip Compression = iota
	KindZstd
	KindBzip2
	KindNone
)

Compression constants.

func Detect

func Detect(r io.Reader) (io.ReadCloser, Compression, error)

Detect follows the same procedure as Reader, but also reports the detected compression scheme.

func (Compression) String

func (i Compression) String() string

Jump to

Keyboard shortcuts

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