peu

package module
v0.0.0-...-231d711 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

README

Peu

GoDoc

un peu: a little

About

Peu makes things smaller, hopefully. Peu can also decompress a given stream if it's compression format is supported. This can either be done by checking the magic number or by using the appropriate method. When the stream ends, the operation ends.

Just provide Peu with an io.Reader and an io.Writer; the rest will be handled for you. For compression, either call Compress and specify the compression format or call the correct compression function. For decompression, just call Decompress; it will figure out the compression format used, if it is a supported one. If the compression format is already known, the format specific Decompress funcs can be called directly too.

Peu is not designed to work with archives. For that, there's carchivum

Supported compression algorithms

  • lz4
  • gzip
  • bzip2 (decompression only)

CLI

Peu is also a cli tool and can be found in https://github.com/mohae/peu/tree/master/cmd/peu

License

Copyright 2015-2016 by Joel Scoble.

This is provided under the Apache 2 License. For more details, please check the included LICENSE file.

Documentation

Overview

Copyright 2015-2016 Joel Scoble. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupported = errors.New("unsupported compression format")
	ErrNoFormat    = errors.New("no compression format specified")
)

Functions

func Compress

func Compress(format string, r io.Reader, w io.Writer) (int64, error)

Compress is the handler for compression. Bytes read is returned along with any non io.EOF error that may have occurred.

func CompressGZip

func CompressGZip(r io.Reader, w io.Writer) (int64, error)

CompressGzip compresses using gzip compression. Bytes read is returned along with any non io.EOF error that may have occurred.

func CompressLZ4

func CompressLZ4(r io.Reader, w io.Writer) (int64, error)

CompressLZ4 compresses using lz4 compression. Bytes read is returned along with any non io.EOF error that may have occurred.

func CompressionFormat

func CompressionFormat(r io.ReaderAt) (compress.Format, error)

CompressionFormat checks to see if the data in the provided reader uses a supported compression format. If it does not, an UnsupportedErr is returned.

func CompressionIsSupported

func CompressionIsSupported(f compress.Format) bool

CompressionIsSupported returns if compression using the Format is supported.

func Decompress

func Decompress(r io.Reader, w io.Writer) (int64, error)

Decompress is the handler for decompression. The decompression format to use is determined by the magic bytes within the data. If no match is found, an ErrUnsupported is returned. Bytes read is returned along with any non io.EOF error that may have occurred. If the reader doesn't implement io.ReaderAt a panic will occur.

func DecompressBZip2

func DecompressBZip2(r io.Reader, w io.Writer) (int64, error)

DecompressBZip2 decompresses data compressed with bzip2 compression. Bytes read is returned along with any non io.EOF error that may have occurred.

func DecompressGZip

func DecompressGZip(r io.Reader, w io.Writer) (int64, error)

DecompressGZip decompresses data compressed with gzip compression. Bytes read is returned along with any non io.EOF error that may have occurred.

func DecompressLZ4

func DecompressLZ4(r io.Reader, w io.Writer) (int64, error)

DecompressLZ4 decompresses data compressed with lz4 compression. Bytes read is returned along with any non io.EOF error that may have occurred.

func DecompressionIsSupported

func DecompressionIsSupported(f compress.Format) bool

Returns if the format is supported for decompression.

Types

This section is empty.

Directories

Path Synopsis
cmd
peu command

Jump to

Keyboard shortcuts

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