unpackit

package module
v0.0.0-...-4ed373e Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 License: MPL-2.0 Imports: 18 Imported by: 0

README

UnpackIt

GoDoc Build Status

This Go library allows you to easily unpack the following files using magic numbers:

  • tar.gz
  • tar.bzip2
  • tar.xz
  • zip
  • tar

Usage

Unpack a file:

    file, _ := os.Open(test.filepath)
    destPath, err := unpackit.Unpack(file, tempDir)

Unpack a stream (such as a http.Response):

    res, err := http.Get(url)
    destPath, err := unpackit.Unpack(res.Body, tempDir)

Documentation

Overview

Package unpackit allows you to easily unpack *.tar.gz, *.tar.bzip2, *.tar.xz, *.zip and *.tar files. There are not CGO involved nor hard dependencies of any type.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unpack

func Unpack(reader io.Reader, destPath string) (string, error)

Unpack unpacks a compressed stream. Magic numbers are used to determine what decompressor and/or unarchiver to use.

func Untar

func Untar(data io.Reader, destPath string) (string, error)

Untar unarchives a TAR archive and returns the final destination path or an error

func Unzip

func Unzip(r io.Reader, destPath string) (string, error)

Unzip unpacks a ZIP stream. When given a os.File reader it will get its size without reading the entire zip file in memory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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