postgres_exporter/vendor/github.com/mholt/archiver
Will Rouesnel 989489096e Refactor repository layout and convert build system to Mage.
This commit implements a massive refactor of the repository, and
moves the build system over to use Mage (magefile.org) which should
allow seamless building across multiple platforms.
2018-03-06 07:29:35 +10:00
..
appveyor.yml Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
archiver.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
build.bash Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
LICENSE Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
rar.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
README.md Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
tar.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
tarbz2.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
targz.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
tarlz4.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
tarsz.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
tarxz.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00
zip.go Refactor repository layout and convert build system to Mage. 2018-03-06 07:29:35 +10:00

archiver archiver GoDoc Linux Build Status Windows Build Status

Package archiver makes it trivially easy to make and extract common archive formats such as .zip, and .tar.gz. Simply name the input and output file(s).

Files are put into the root of the archive; directories are recursively added, preserving structure.

The archiver command runs the same cross-platform and has no external dependencies (not even libc); powered by the Go standard library, dsnet/compress, nwaples/rardecode, and ulikunitz/xz. Enjoy!

Supported formats/extensions:

  • .zip
  • .tar
  • .tar.gz & .tgz
  • .tar.bz2 & .tbz2
  • .tar.xz & .txz
  • .tar.lz4 & .tlz4
  • .tar.sz & .tsz
  • .rar (open only)

Install

go get github.com/mholt/archiver/cmd/archiver

Or download binaries from the releases page.

Command Use

Make a new archive:

$ archiver make [archive name] [input files...]

(At least one input file is required.)

To extract an archive:

$ archiver open [archive name] [destination]

(The destination path is optional; default is current directory.)

The archive name must end with a supported file extension—this is how it knows what kind of archive to make. Run archiver -h for more help.

Library Use

import "github.com/mholt/archiver"

Create a .zip file:

err := archiver.Zip.Make("output.zip", []string{"file.txt", "folder"})

Extract a .zip file:

err := archiver.Zip.Open("input.zip", "output_folder")

Working with other file formats is exactly the same, but with their own Archiver implementations.

FAQ

Can I list a file in one folder to go into a different folder in the archive?

No. This works just like your OS would make an archive in the file explorer: organize your input files to mirror the structure you want in the archive.

Can it add files to an existing archive?

Nope. This is a simple tool; it just makes new archives or extracts existing ones.