unpackit

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: MPL-2.0 Imports: 17 Imported by: 41 modules, 40 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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)
    err := unpackit.Unpack(file, tempDir)

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

    res, err := http.Get(url)
    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) 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) error

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

func Unzip

func Unzip(r io.Reader, destPath 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
⌂ 换网址