uncompressed

package module
v0.0.0-...-90c1e10 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: MIT Imports: 8 Imported by: 0

README

uncompressed Reader

Go

No need to import. Reference implementation.

Uncompressed provides uncompressed reader from various compressed readers.

Uncompressed reader identifies the file from the magic number in the first few bytes.

Supported compression formats are gzip, bzip2, zstd, lz4, xz.

example

package main

import (
	"io"
	"os"

	"github.com/noborus/uncompressed"
)

func main() {
	file, err := os.Open("test.txt.zstd")
	if err != nil {
		panic(err)
	}
	defer file.Close()
	r := uncompressed.NewReader(file)
	io.Copy(os.Stdout, r)
}

See _examples/zzcat for more details.

Documentation

Overview

Package uncompressed provides a reader to uncompress the compressed data.

Read the first magic number of the data and select the appropriate uncompressed reader.

Example
package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"

	"github.com/noborus/uncompressed"
)

func main() {
	file, err := os.Open(filepath.Join("testdata", "test.txt.zstd"))
	if err != nil {
		panic(err)
	}
	defer file.Close()
	r := uncompressed.NewReader(file)
	fmt.Println(ioutil.ReadAll(r))
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReader

func NewReader(reader io.Reader) io.ReadCloser

NewReader returns a new uncompressed Reader.

Types

This section is empty.

Directories

Path Synopsis
_examples

Jump to

Keyboard shortcuts

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