uncompress

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package uncompress permits seamless opening of compressed input files.

Index

Constants

This section is empty.

Variables

View Source
var Exts = map[string]Opener{
	"Z":   gzipOpener,
	"z":   gzipOpener,
	"gz":  gzipOpener,
	"bz2": bzip2Opener,
	"xz":  xzOpener,
}

Exts maps a file suffix to the name of the program to use in OpenFile for uncompressing it. Callers may modify Exts as needed.

Functions

func Open

func Open(name string) (io.ReadCloser, error)

Open opens the named file for reading. If the file name has one of several special suffixes, the resulting ReadCloser contains the result of uncompressing the file contents, using the uncompressing method determined by Exts. If the file does not have a suffix from Exts, OpenFile falls back to using os.Open.

Types

type Opener

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

An Opener receives a ReadCloser with compressed data and returns a ReadCloser with uncompressed data.

Jump to

Keyboard shortcuts

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