• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..18-Jul-2019-

.gitignoreH A D18-Jul-201958 65

.travis.ymlH A D18-Jul-2019298 2216

LICENSEH A D18-Jul-20191 KiB2117

README.mdH A D18-Jul-20192.5 KiB8449

appveyor.ymlH A D18-Jul-2019613 3324

archiver.goH A D18-Jul-20192.9 KiB12089

build.bashH A D18-Jul-20191,007 2116

rar.goH A D18-Jul-20192.7 KiB11780

tar.goH A D18-Jul-20195.9 KiB245177

tarbz2.goH A D18-Jul-20192.7 KiB10771

targz.goH A D18-Jul-20192.3 KiB9968

tarlz4.goH A D18-Jul-20192.4 KiB9358

tarsz.goH A D18-Jul-20192.4 KiB9358

tarxz.goH A D18-Jul-20192.6 KiB10669

zip.goH A D18-Jul-20195.3 KiB239175

README.md

1archiver [![archiver GoDoc](https://img.shields.io/badge/reference-godoc-blue.svg?style=flat-square)](https://godoc.org/github.com/mholt/archiver) [![Linux Build Status](https://img.shields.io/travis/mholt/archiver.svg?style=flat-square&label=linux+build)](https://travis-ci.org/mholt/archiver) [![Windows Build Status](https://img.shields.io/appveyor/ci/mholt/archiver.svg?style=flat-square&label=windows+build)](https://ci.appveyor.com/project/mholt/archiver)
2========
3
4Package 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).
5
6Files are put into the root of the archive; directories are recursively added, preserving structure.
7
8The `archiver` command runs the same cross-platform and has no external dependencies (not even libc); powered by the Go standard library, [dsnet/compress](https://github.com/dsnet/compress), [nwaples/rardecode](https://github.com/nwaples/rardecode), and [ulikunitz/xz](https://github.com/ulikunitz/xz). Enjoy!
9
10Supported formats/extensions:
11
12- .zip
13- .tar
14- .tar.gz & .tgz
15- .tar.bz2 & .tbz2
16- .tar.xz & .txz
17- .tar.lz4 & .tlz4
18- .tar.sz & .tsz
19- .rar (open only)
20
21
22## Install
23
24```bash
25go get github.com/mholt/archiver/cmd/archiver
26```
27
28Or download binaries from the [releases](https://github.com/mholt/archiver/releases) page.
29
30
31## Command Use
32
33Make a new archive:
34
35```bash
36$ archiver make [archive name] [input files...]
37```
38
39(At least one input file is required.)
40
41To extract an archive:
42
43```bash
44$ archiver open [archive name] [destination]
45```
46
47(The destination path is optional; default is current directory.)
48
49The 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.
50
51
52## Library Use
53
54```go
55import "github.com/mholt/archiver"
56```
57
58Create a .zip file:
59
60```go
61err := archiver.Zip.Make("output.zip", []string{"file.txt", "folder"})
62```
63
64Extract a .zip file:
65
66```go
67err := archiver.Zip.Open("input.zip", "output_folder")
68```
69
70Working with other file formats is exactly the same, but with [their own Archiver implementations](https://godoc.org/github.com/mholt/archiver#Archiver).
71
72
73
74## FAQ
75
76#### Can I list a file in one folder to go into a different folder in the archive?
77
78No. 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.
79
80
81#### Can it add files to an existing archive?
82
83Nope. This is a simple tool; it just makes new archives or extracts existing ones.
84