Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 18-Jul-2019 | - | ||||
.gitignore | H A D | 18-Jul-2019 | 58 | 6 | 5 | |
.travis.yml | H A D | 18-Jul-2019 | 298 | 22 | 16 | |
LICENSE | H A D | 18-Jul-2019 | 1 KiB | 21 | 17 | |
README.md | H A D | 18-Jul-2019 | 2.5 KiB | 84 | 49 | |
appveyor.yml | H A D | 18-Jul-2019 | 613 | 33 | 24 | |
archiver.go | H A D | 18-Jul-2019 | 2.9 KiB | 120 | 89 | |
build.bash | H A D | 18-Jul-2019 | 1,007 | 21 | 16 | |
rar.go | H A D | 18-Jul-2019 | 2.7 KiB | 117 | 80 | |
tar.go | H A D | 18-Jul-2019 | 5.9 KiB | 245 | 177 | |
tarbz2.go | H A D | 18-Jul-2019 | 2.7 KiB | 107 | 71 | |
targz.go | H A D | 18-Jul-2019 | 2.3 KiB | 99 | 68 | |
tarlz4.go | H A D | 18-Jul-2019 | 2.4 KiB | 93 | 58 | |
tarsz.go | H A D | 18-Jul-2019 | 2.4 KiB | 93 | 58 | |
tarxz.go | H A D | 18-Jul-2019 | 2.6 KiB | 106 | 69 | |
zip.go | H A D | 18-Jul-2019 | 5.3 KiB | 239 | 175 |
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