Open Source Go Library for Working with Archives

Creating, Managing & Extracting Archives with ease using cross-platform, high-level Go API.

Archive is an open source Go library that provides functionality for creating, managing & extracting archives with ease using Go commands. The library is stable, cross-platform, high-level archival and compression operations for a variety of formats. Some of the most common functions such as Archive, Unarchive, Extract, CompressFile, and DecompressFile are implemented at the package level for user’s convenience.

The library enables software developers to compress & decompress files of various compression file formats such as Brotli (br), Bzip2 (bz2), Flate (ZIP), Gzip (GZ), lz4, snappy (SZ), xz, and Zstandard (ZSTD). It also provides support for archiving formats like ZIP, TAR, and RAR.

The API is well documented and easy to use. It provides complete support for several important features related to compression and decompression such as create archives, Extract folder from archives, compress files, decompress files, extract specific files, Stream files, Traverse archive contents, create and Open password-protected RAR archives, streaming compression as well as decompression, and much more.

Previous Next

Getting Started with Archive

The recommended way to install Archive is from GitHub. Use the following command for smooth installation.

Install Archive via command

go get github.com/mholt/Archive/cmd/arc"

Create an Archive File via Go

The Archive library enables software developers to create an archive file using a couple of lines of Go code. You can also easily add a file or folder to the archive. The file will be added to the top level of the archive and the directories are recursively added. When creating archives or compressing files using a specific instance of the format's type, the name of the output file MUST match that of the format in order to prevent confusion later on.

Compress and Decompress Files

The open source Archive library enables software developers to compress and decompress files inside their own applications. There are several important functions and methods included for compressing and decompressing files. You can use easily compress a file or directory, decompress a file or directory, extract a specific file, folder extraction, and many more.

Extract a Specific File or Folder from Archive

The open source Archive library enables software developers to read & extract a specific file using Go API. The library supports extracting files and folders into a place of your choice with just a couple of lines of code. You can easily select a particular file from a provided archive and can extract it to a place of your choice. Same as file you can also extract an entire folder to the destination of your choice.