Easily create & extract archives, and compress & decompress files of various formats

Overview

archiver archiver GoDoc

Introducing Archiver 3.1 - a cross-platform, multi-format archive utility and Go library. A powerful and flexible library meets an elegant CLI in this generic replacement for several platform-specific or format-specific archive utilities.

Features

Package archiver makes it trivially easy to make and extract common archive formats such as tarball (and its compressed variants) and zip. Simply name the input and output file(s). The arc command runs the same on all platforms and has no external dependencies (not even libc). It is powered by the Go standard library and several third-party, pure-Go libraries.

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

  • Make whole archives from a list of files
  • Open whole archives to a folder
  • Extract specific files/folders from archives
  • Stream files in and out of archives without needing actual files on disk
  • Traverse archive contents without loading them
  • Compress files
  • Decompress files
  • Streaming compression and decompression
  • Several archive and compression formats supported

Format-dependent features

  • Gzip is multithreaded
  • Optionally create a top-level folder to avoid littering a directory or archive root with files
  • Toggle overwrite existing files
  • Adjust compression level
  • Zip: store (not compress) already-compressed files
  • Make all necessary directories
  • Open password-protected RAR archives
  • Optionally continue with other files after an error

Supported compression formats

  • brotli (br)
  • bzip2 (bz2)
  • flate (zip)
  • gzip (gz)
  • lz4
  • snappy (sz)
  • xz
  • zstandard (zstd)

Supported archive formats

  • .zip
  • .tar (including any compressed variants like .tar.gz)
  • .rar (read-only)

Tar files can optionally be compressed using any of the above compression formats.

GoDoc

See https://pkg.go.dev/github.com/mholt/archiver/v3

Install

With webi

webi will install webi and arc to ~/.local/bin/ and update your PATH.

Mac, Linux, Raspberry Pi

curl -fsS https://webinstall.dev/arc | bash

Windows 10

curl.exe -fsS -A MS https://webinstall.dev/arc | powershell

With Go

To install the runnable binary to your $GOPATH/bin:

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

Manually

To install manually

  1. Download the binary for your platform from the Github Releases page.
  2. Move the binary to a location in your path, for example:
    • without sudo:
      chmod a+x ~/Downloads/arc_*
      mkdir -p ~/.local/bin
      mv ~/Downloads/arc_* ~/.local/bin/arc
    • as root:
      chmod a+x ~/Downloads/arc_*
      sudo mkdir -p /usr/local/bin
      sudo mv ~/Downloads/arc_* /usr/local/bin/arc
  3. If needed, update ~/.bashrc or ~/.profile to include add arc in your PATH, for example:
    echo 'PATH="$HOME:/.local/bin:$PATH"' >> ~/.bashrc
    

Build from Source

You can successfully build arc with just the go tooling, or with goreleaser.

With go

go build cmd/arc/*.go

Multi-platform with goreleaser

Builds with goreleaser will also include version info.

goreleaser --snapshot --skip-publish --rm-dist

Command Use

Make new archive

# Syntax: arc archive [archive name] [input files...]

arc archive test.tar.gz file1.txt images/file2.jpg folder/subfolder

(At least one input file is required.)

Extract entire archive

# Syntax: arc unarchive [archive name] [destination]

arc unarchive test.tar.gz

(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 arc help for more help.

List archive contents

# Syntax: arc ls [archive name]

arc ls caddy_dist.tar.gz
drwxr-xr-x  matt    staff   0       2018-09-19 15:47:18 -0600 MDT   dist/
-rw-r--r--  matt    staff   6148    2017-08-07 18:34:22 -0600 MDT   dist/.DS_Store
-rw-r--r--  matt    staff   22481   2018-09-19 15:47:18 -0600 MDT   dist/CHANGES.txt
-rw-r--r--  matt    staff   17189   2018-09-19 15:47:18 -0600 MDT   dist/EULA.txt
-rw-r--r--  matt    staff   25261   2016-03-07 16:32:00 -0700 MST   dist/LICENSES.txt
-rw-r--r--  matt    staff   1017    2018-09-19 15:47:18 -0600 MDT   dist/README.txt
-rw-r--r--  matt    staff   288     2016-03-21 11:52:38 -0600 MDT   dist/gitcookie.sh.enc
...

Extract a specific file or folder from an archive

# Syntax: arc extract [archive name] [path in archive] [destination on disk]

arc extract test.tar.gz foo/hello.txt extracted/hello.txt

Compress a single file

# Syntax: arc compress [input file] [output file]

arc compress test.txt compressed_test.txt.gz
arc compress test.txt gz

For convenience, the output file (second argument) may simply be a compression format (without leading dot), in which case the output filename will be the same as the input filename but with the format extension appended, and the input file will be deleted if successful.

Decompress a single file

# Syntax: arc decompress [input file] [output file]

arc decompress test.txt.gz original_test.txt
arc decompress test.txt.gz

For convenience, the output file (second argument) may be omitted. In that case, the output filename will have the same name as the input filename, but with the compression extension stripped from the end; and the input file will be deleted if successful.

Flags

Flags are specified before the subcommand. Use arc help or arc -h to get usage help and a description of flags with their default values.

Library Use

The archiver package allows you to easily create and open archives, walk their contents, extract specific files, compress and decompress files, and even stream archives in and out using pure io.Reader and io.Writer interfaces, without ever needing to touch the disk.

To use as a dependency in your project:

go get github.com/mholt/archiver/v3
import "github.com/mholt/archiver/v3"

See the package's GoDoc for full API documentation.

For example, creating or unpacking an archive file:

err := archiver.Archive([]string{"testdata", "other/file.txt"}, "test.zip")
// ...
err = archiver.Unarchive("test.tar.gz", "test")

The archive format is determined by file extension. (There are several functions in this package which perform a task by inferring the format from file extension or file header, including Archive(), Unarchive(), CompressFile(), and DecompressFile().)

To configure the archiver used or perform, create an instance of the format's type:

z := archiver.Zip{
	CompressionLevel:       flate.DefaultCompression,
	MkdirAll:               true,
	SelectiveCompression:   true,
	ContinueOnError:        false,
	OverwriteExisting:      false,
	ImplicitTopLevelFolder: false,
}

err := z.Archive([]string{"testdata", "other/file.txt"}, "/Users/matt/Desktop/test.zip")

Inspecting an archive:

err = z.Walk("/Users/matt/Desktop/test.zip", func(f archiver.File) error {
	zfh, ok := f.Header.(zip.FileHeader)
	if ok {
		fmt.Println("Filename:", zfh.Name)
	}
	return nil
})

Streaming files into an archive that is being written to the HTTP response:

err = z.Create(responseWriter)
if err != nil {
	return err
}
defer z.Close()

for _, fname := range filenames {
	info, err := os.Stat(fname)
	if err != nil {
		return err
	}

	// get file's name for the inside of the archive
	internalName, err := archiver.NameInArchive(info, fname, fname)
	if err != nil {
		return err
	}

	// open the file
	file, err := os.Open(f)
	if err != nil {
		return err
	}

	// write it to the archive
	err = z.Write(archiver.File{
		FileInfo: archiver.FileInfo{
			FileInfo:   info,
			CustomName: internalName,
		},
		ReadCloser: file,
	})
	file.Close()
	if err != nil {
		return err
	}
}

The archiver.File type allows you to use actual files with archives, or to mimic files when you only have streams.

There's a lot more that can be done, too. See the GoDoc for full API documentation.

Security note: This package does NOT attempt to mitigate zip-slip attacks. It is extremely difficult to do properly and seemingly impossible to mitigate effectively across platforms. Attempted fixes have broken processing of legitimate files in production, rendering the program unusable. Our recommendation instead is to inspect the contents of an untrusted archive before extracting it (this package provides Walkers) and decide if you want to proceed with extraction.

Project Values

This project has a few principle-based goals that guide its development:

  • Do our thing really well. Our thing is creating, opening, inspecting, compressing, and streaming archive files. It is not meant to be a replacement for specific archive format tools like tar, zip, etc. that have lots of features and customizability. (Some customizability is OK, but not to the extent that it becomes overly complicated or error-prone.)

  • Have good tests. Changes should be covered by tests.

  • Limit dependencies. Keep the package lightweight.

  • Pure Go. This means no cgo or other external/system dependencies. This package should be able to stand on its own and cross-compile easily to any platform -- and that includes its library dependencies.

  • Idiomatic Go. Keep interfaces small, variable names semantic, vet shows no errors, the linter is generally quiet, etc.

  • Be elegant. This package should be elegant to use and its code should be elegant when reading and testing. If it doesn't feel good, fix it up.

  • Well-documented. Use comments prudently; explain why non-obvious code is necessary (and use tests to enforce it). Keep the docs updated, and have examples where helpful.

  • Keep it efficient. This often means keep it simple. Fast code is valuable.

  • Consensus. Contributions should ideally be approved by multiple reviewers before being merged. Generally, avoid merging multi-chunk changes that do not go through at least one or two iterations/reviews. Except for trivial changes, PRs are seldom ready to merge right away.

  • Have fun contributing. Coding is awesome!

We welcome contributions and appreciate your efforts! However, please open issues to discuss any changes before spending the time preparing a pull request. This will save time, reduce frustration, and help coordinate the work. Thank you!

Issues
  • Add support for storing symlinks in tar and zip archives

    Add support for storing symlinks in tar and zip archives

    Also implement extraction of symlinks from zip archives.

    This PR also adds a relative symlink in the testdata directory. It passes all tests on OS X, but has not been tested on Windows.

    This PR is a superset of changes from the following issues and PRs:

    Fixes #21 Fixes #31 Fixes #60 Fixes #74

    opened by jandubois 20
  • RFE: port to github.com/pierrec/lz4/v4

    RFE: port to github.com/pierrec/lz4/v4

    What would you like to have changed?

    Make it possible to build with github.com/pierrec/lz4/v4.

    Why is this feature a useful, necessary, and/or important addition to this project?

    lz4 was updated to 4.0.2 in Fedora rawhide and archiver no longer builds using distribution-provided Go packages as a result.

    What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?

    I'm forced to stop updating archiver until it's ported to lz4 v4 API or someone creates a compatibility package with v3 API.

    Please link to any relevant issues, pull requests, or other discussions.

    To see the issue, patch the source with the following patch:

    diff -up archiver-3.3.2/lz4.go.lz4 archiver-3.3.2/lz4.go
    --- archiver-3.3.2/lz4.go.lz4	2020-09-28 10:43:21.000000000 +0200
    +++ archiver-3.3.2/lz4.go	2020-10-05 13:06:07.879465436 +0200
    @@ -5,7 +5,7 @@ import (
     	"io"
     	"path/filepath"
     
    -	"github.com/pierrec/lz4/v3"
    +	"github.com/pierrec/lz4"
     )
     
     // Lz4 facilitates LZ4 compression.
    diff -up archiver-3.3.2/tarlz4.go.lz4 archiver-3.3.2/tarlz4.go
    --- archiver-3.3.2/tarlz4.go.lz4	2020-09-28 10:43:21.000000000 +0200
    +++ archiver-3.3.2/tarlz4.go	2020-10-05 13:06:17.578418304 +0200
    @@ -5,7 +5,7 @@ import (
     	"io"
     	"strings"
     
    -	"github.com/pierrec/lz4/v3"
    +	"github.com/pierrec/lz4"
     )
     
     // TarLz4 facilitates lz4 compression
    

    and build. Fedora package build process fails with the following errors:

    _build/src/github.com/mholt/archiver/lz4.go:19:3: w.Header undefined (type *lz4.Writer has no field or method Header)
    _build/src/github.com/mholt/archiver/tarlz4.go:87:7: lz4w.Header undefined (type *lz4.Writer has no field or method Header)
    

    It looks like option handling and compression level setting got changed: https://github.com/pierrec/lz4/compare/v3.3.2..v4.0.2

    I have nearly zero Golang knowledge, but this crude patch makes it compile and go test passes:

    diff -up archiver-3.3.2/lz4.go.lz4 archiver-3.3.2/lz4.go
    --- archiver-3.3.2/lz4.go.lz4	2020-09-28 10:43:21.000000000 +0200
    +++ archiver-3.3.2/lz4.go	2020-10-05 13:28:21.581995885 +0200
    @@ -5,7 +5,7 @@ import (
     	"io"
     	"path/filepath"
     
    -	"github.com/pierrec/lz4/v3"
    +	"github.com/pierrec/lz4"
     )
     
     // Lz4 facilitates LZ4 compression.
    @@ -16,7 +16,12 @@ type Lz4 struct {
     // Compress reads in, compresses it, and writes it to out.
     func (lz *Lz4) Compress(in io.Reader, out io.Writer) error {
     	w := lz4.NewWriter(out)
    -	w.Header.CompressionLevel = lz.CompressionLevel
    +	options := []lz4.Option{
    +		lz4.CompressionLevelOption(lz4.CompressionLevel(1 << (8 + lz.CompressionLevel))),
    +	}
    +	if err := w.Apply(options...); err != nil {
    +		return err
    +	}
     	defer w.Close()
     	_, err := io.Copy(w, in)
     	return err
    diff -up archiver-3.3.2/tarlz4.go.lz4 archiver-3.3.2/tarlz4.go
    --- archiver-3.3.2/tarlz4.go.lz4	2020-09-28 10:43:21.000000000 +0200
    +++ archiver-3.3.2/tarlz4.go	2020-10-05 13:28:21.581995885 +0200
    @@ -5,7 +5,7 @@ import (
     	"io"
     	"strings"
     
    -	"github.com/pierrec/lz4/v3"
    +	"github.com/pierrec/lz4"
     )
     
     // TarLz4 facilitates lz4 compression
    @@ -84,7 +84,12 @@ func (tlz4 *TarLz4) wrapWriter() {
     	var lz4w *lz4.Writer
     	tlz4.Tar.writerWrapFn = func(w io.Writer) (io.Writer, error) {
     		lz4w = lz4.NewWriter(w)
    -		lz4w.Header.CompressionLevel = tlz4.CompressionLevel
    +		options := []lz4.Option{
    +			lz4.CompressionLevelOption(lz4.CompressionLevel(1 << (8 + tlz4.CompressionLevel))),
    +		}
    +		if err := lz4w.Apply(options...); err != nil {
    +			return lz4w, err
    +		}
     		return lz4w, nil
     	}
     	tlz4.Tar.cleanupWrapFn = func() {
    
    feature request 
    opened by rathann 13
  • fix: prevent extraction of archived files outside target path

    fix: prevent extraction of archived files outside target path

    Why this PR?

    This PR is meant to fix an arbitrary file write vulnerability, that can be achieved using a specially crafted zip archive, that holds path traversal filenames. When the filename gets concatenated to the target extraction directory, the final path ends up outside of the target folder.

    A sample malicious zip file named zip-slip.zip. (see this gist) was used, and when running the code below, resulted in creation of evil.txt file in /tmp folder.

    package main
    
    import "log"
    import "github.com/mholt/archiver"
    
    func main() {
    	err := archiver.Tar.Open("/tmp/evil-tar.tar", "/tmp/safe")
    	if err != nil {
    		log.Fatal(err)
    	}
    }
    

    There are various possible ways to avoid this issue, some include checking for .. (dot dot) characters in the filename, but the best solution in our opinion is to check if the final target filename, starts with the target folder (after both are resolved to their absolute path).

    Stay secure, Snyk Team

    opened by aviadatsnyk 13
  • craft zip file for symlink testing

    craft zip file for symlink testing

    We need a special zip file that cannot be created with normal commandline tools. It requires crafting with an API. This should be possible with archive/zip#Writer, for example.

    We want a double entry of a file - the first being a symlink such that the second will be placed in an arbitrary location:

    ./goodfile.txt  "hello world"         (file)
    ./bad/file.txt  => ../../badfile.txt  (symlink)
    ./bad/file.txt  "Mwa-ha-ha"           (file)
    ./morefile.txt  "hello world"         (file)
    

    This should go in testdata/testarchives/evilarchives/ as double-evil.zip and double-evil.tar (if it is allowed).

    See also https://github.com/mholt/archiver/issues/242#issuecomment-703086020

    up-for-grabs Go hacktoberfest hacktoberfest-accepted 
    opened by coolaj86 13
  • Fix hard links

    Fix hard links

    Had to refactor how paths/filenames are passed into some functions to accommodate hard-linked files.

    @petemoore Would you please try this out?

    Should fix #152.

    opened by mholt 12
  • Installation Instructions Incorrect / go get fails

    Installation Instructions Incorrect / go get fails

    What version of the package or command are you using?

    Not sure how to check. I just ran go get github.com/mholt/archiver/v3

    What are you trying to do?

    Install the package and use it.

    What steps did you take?

    Installed go on Windows. Ran go get github.com/mholt/archiver/v3

    What did you expect to happen, and what actually happened instead?

    The package should successfully install.

    This happened instead:

    package github.com/mholt/archiver/v3: cannot find package "github.com/mholt/archiver/v3" in any of:
            c:\go\src\github.com\mholt\archiver\v3 (from $GOROOT)
            C:\Users\vroy1\go\src\github.com\mholt\archiver\v3 (from $GOPATH)
    

    Doing go get github.com/mholt/archiver works better and throws the following error instead:

    C:\Users\vroy1\Desktop\server>go get github.com/mholt/archiver/  
    package github.com/pierrec/lz4/v3: cannot find package "github.com/pierrec/lz4/v3" in any of:
            c:\go\src\github.com\pierrec\lz4\v3 (from $GOROOT)
            C:\Users\vroy1\go\src\github.com\pierrec\lz4\v3 (from $GOPATH)
    

    Please link to any related issues, pull requests, and/or discussion

    https://github.com/mholt/archiver/issues/195

    opened by vedantroy 11
  • Add a way to strip top-level folder

    Add a way to strip top-level folder

    Closes #238

    opened by illiliti 11
  • use filepath.Dir() instead of path.Dir()

    use filepath.Dir() instead of path.Dir()

    Please use filepath.Dir(), not path.Dir().

    In Windows, following code doesn't work with Error peco_windows_amd64\peco_windows_amd64\Changes: creating new file: open peco_windows_amd64\peco_windows_amd64\Changes: The system cannot find the path specified.

    package main
    
    import (
        "fmt"
        "io"
        "net/http"
        "os"
        "path"
    
        "github.com/mholt/archiver"
    )
    
    func main() {
        url := "https://github.com/peco/peco/releases/download/v0.4.0/peco_windows_amd64.zip"
        resp, _ := http.Get(url)
        defer resp.Body.Close()
        fname := path.Base(url)
        f, _ := os.Create(fname)
        io.Copy(f, resp.Body)
    
        err := archiver.Unzip(fname, "peco_windows_amd64")
        if err != nil {
            fmt.Println(err.Error())
        }
    }
    
    

    And following code doesn't extract .tar.gz file including symlink with Error: dest\hoge.txt: creating new file: open dest\hoge.txt: The system cannot find the path specified.

    $ tar -tvf hoge.tar.gz
    -rw-r--r-- username/197121     0 2016-08-20 14:35 hoge.txt
    lrwxrwxrwx username/197121     0 2016-08-20 14:12 link -> hoge.txt
    
    package main
    
    import (
        "fmt"
    
        "github.com/mholt/archiver"
    )
    
    func main() {
        err := archiver.UntarGz("hoge.tar.gz", "dest")
        if err != nil {
            fmt.Println(err.Error())
        }
    
    opened by whatalnk 11
  • Update github.com/pierrec/lz4 dependency to module version

    Update github.com/pierrec/lz4 dependency to module version

    Updates dependency to use github.com/pierrec/lz4/v3 at version v3.0.1. This version is functionally equivalent to the previously specified dependency.

    opened by nmiyake 11
  • Support for Zip / Rar

    Support for Zip / Rar "aliases"

    What would you like to have changed?

    Allow "aliases" for zip and rar files, i.e. make the allowed extensions configurable.

    Why is this feature a useful, necessary, and/or important addition to this project?

    I'd like to use archiver to extract images from comic files. These files often have the extensions cbz (= zip) or cbr (= rar). They are perfectly fine zip or rar files with a different extension to show that these are comic reader files. Currently these formats are not recognized as archiver uses the file extension to determine the file type. It would be great if one can provide a list of extension "aliases" for different file types, e.g. "if the extension is zip or cbz, then use zip, if it's rar or cbr use rar".

    What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?

    I'm coming from Java, where the input for the classes responsible for handling zipped files is an input stream, so the file extension is not used at all and it's irrelevant which extension the original file had.

    Please link to any relevant issues, pull requests, or other discussions.

    feature request 
    opened by matthjes 10
  • How to deal with directory encoding format

    How to deal with directory encoding format

    What version of the package or command are you using?

    version: github.com/mholt/archiver/v3 v3.5.0 env: Win10 ,PC

    What are you trying to do?

    I want to archive a directory to tar file, directory has Chinese name sub_directory and Chinese file like this

    D:/tmp/device-file/test/helo.txt
    D:/tmp/device-file/test/你好/hello.txt
    D:/tmp/device-file/test/你好.txt
    
    
    func main() {
    	tarName := "D:/tmp/device-file/test.tar"
    	err := archiver.Archive([]string{
    		"D:/tmp/device-file/test", // directory
    	}, tarName)
    	if err != nil {
    		return
    	}
    }
    
    

    What did you expect to happen, and what actually happened instead?

    i want except format below tar_path_ok but actual format below tar_path

    Directory format is not the same

    What should i do?

    thanks

    opened by rockli0724 0
  • extract is broken when extracting folders from zip (only creates folders)

    extract is broken when extracting folders from zip (only creates folders)

    What version of the package or command are you using?

    arc v3.5.0 25e050dbb4e3c591402916201098241bb661a2f7 (2020-10-30T03:27:58Z)

    What are you trying to do?

    Extracting a single directory from a zip file.

    What steps did you take?

    repro

    wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10_openj9-0.26.0/OpenJDK8U-jre_x64_windows_openj9_8u292b10_openj9-0.26.0.zip
    arc extract OpenJDK8U-jre_x64_windows_openj9_8u292b10_openj9-0.26.0.zip jdk8u292-b10-jre extracted
    
    # note that there are no files, only directories
    ls -l extracted/jdk8u292-b10-jre/bin
    

    ls output

    drwxr-xr-x  3 root root 4096 Jul 25 13:50 JAWTAccessBridge-64.dll
    drwxr-xr-x  3 root root 4096 Jul 25 13:50 JavaAccessBridge-64.dll
    drwxr-xr-x  3 root root 4096 Jul 25 13:50 WindowsAccessBridge-64.dll
    drwxr-xr-x  3 root root 4096 Jul 25 13:50 awt.dll
    [...]
    

    What did you expect to happen, and what actually happened instead?

    Should properly extract directory from archive, instead only directories where created. Everything that should have been files ended up as empty directories. I don't know if this is limited to the zip file is used but it works if i extract the whole archive.

    How do you think this should be fixed?

    Not sure.

    Please link to any related issues, pull requests, and/or discussion

    Found nothing

    Bonus: What do you use archiver for, and do you find it useful?

    OpenJDK extraction, modpack extraction for https://github.com/minepkg/minepkg

    opened by fiws 0
  •  cannot find package

    cannot find package "github.com/pierrec/lz4/v4" # The Version4 `v4`

    main issue

    [[email protected] art-cli]$ go build main.go
    ../github.com/mholt/archiver/lz4.go:8:2: cannot find package "github.com/pierrec/lz4/v4" in any of:
    /usr/local/go/src/github.com/pierrec/lz4/v4 (from $GOROOT)
    /home/dasm/go/src/github.com/pierrec/lz4/v4 (from $GOPATH)
    
    opened by chunu67 0
  • tar.zst doesn't seem supported

    tar.zst doesn't seem supported

    What version of the package or command are you using?

    I did a fresh go get github.com/mholt/archiver/cmd/arc

    What are you trying to do?

    Compress a file to tar.zst

    What steps did you take?

    1. go get github.com/mholt/archiver/cmd/arc
    2. arc compress foo tar.zst
    3. format unrecognized by filename: tar.zst

    What did you expect to happen, and what actually happened instead?

    I expect to get a tar.zst archive. I got an error message instead.

    opened by kivutar 0
  • Seeking new maintainer(s)

    Seeking new maintainer(s)

    This library continues to be popular, but I haven't been able to allocate the time necessary to work on it. Like other of my open source projects, it has gone beyond the realm of "fun weekend project that only I use" to "numerous real world use cases relying on it" -- and my sponsorships are currently swaying me to work on Caddy projects.

    I'm opening this up to others who would like to volunteer to maintain this. I don't mean to merely submit a PR, but I mean to review PRs, triage issues, and in general to facilitate the ongoing development of the project over a long period of time. I'll be mostly hands-off -- unless you want another opinion on things or if you want some technical vision, but I just don't have the time to devote to development of this right now.

    Maintainership is not a glorious role, but it's great experience and it can be fun. It is also a necessity for someone to do, if you use or rely on this library. That could be you! :)

    Who would like to commit to this role? Could probably add a few maintainers.

    help wanted 
    opened by mholt 1
  • Is it possible to unrar a file from memory rather than having to write it to disk and pass it a file name?

    Is it possible to unrar a file from memory rather than having to write it to disk and pass it a file name?

    Hello, a bit new to go so apologies if i'm missing something obvious here. But is there a simple way to pass an ioReader containing a .rar to one of the functions and then init the Rar from the ioReader rather than having to pass it the file path?

    Thanks.

    opened by mcastrogg 0
  • Filter function for zip archiver

    Filter function for zip archiver

    If need be a filter function can be added to the other archivers, it's pretty straight forward!

    Need for similar reasons as described in #279

    opened by jhwz 0
  • Is there a way no to preserve file attributes?

    Is there a way no to preserve file attributes?

    Hi, thanks for creating this tool!

    I use it for database archiving, i.e. I generate SQL of a database and then archive it. In case there were no changes in the DB, the content of those files is the same (md5 hash is the same), but the creation, modification, and access time stamps are different. When I use archiver to create an archive, the archive checksum is different of course because of those extended attributes of files that are within it.

    Is there a way to disable preserving those attributes while creating archives? Obviously, all 3 would be set to the moment of extraction of such archive.

    feature request 
    opened by ivanduka 2
  • Exclude files by pattern

    Exclude files by pattern

    What would you like to have changed?

    Currently there is only an ability (at least it's documented so) to specify files/directories to add into archive. Exclude some files from specified directories by pattern would be helpful.

    Why is this feature a useful, necessary, and/or important addition to this project?

    My use-case is filtering logs with *.log extension out, but I'm sure there are a lot of other ones.

    What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?

    Make a copy of the directory to compress, remove unnecessary files, compress.

    feature request 
    opened by atsikham 1
  • Remove unconditional extention-check in library code

    Remove unconditional extention-check in library code

    What would you like to have changed?

    In all of the implementations of Archiver a hard-coded CheckExt is being invoked within Archive func. I propose removing this check from Archive and Unarchive and instead move it to the code that e.g. determines Archiver to be used. The operations of specific Archiver should not do any extension checking.

    Why is this feature a useful, necessary, and/or important addition to this project?

    When using archiver as library there are plenty of scenarios (e.g. temp files, in-memory files being compressed before transfer as a payload, number of well-known file names that internally are just archives, etc.) when file extension is just irrelevant. When selecting archiver implementation e.g. by archiver.DefaultTar the decision about format is already carried out so checking for extension within funcs of selected implementation seems to be redundant.

    What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?

    Current hack is to always create a temp file with the required extension and copy stuff back and forth, which causes boiler-plate code and additional ways to break code.

    Please link to any relevant issues, pull requests, or other discussions.

    Similar request here: https://github.com/mholt/archiver/issues/255

    feature request 
    opened by fahman 0
Releases(v3.5.0)
Owner
Matt Holt
M.S. Computer Science. Author of the Caddy Web Server, CertMagic, Papa Parse, JSON/curl-to-Go, Timeliner, Relica, and more...
Matt Holt
Fastzip is an opinionated Zip archiver and extractor with a focus on speed.

Fastzip is an opinionated Zip archiver and extractor with a focus on speed. Archiving and extraction of files and directories can only occur w

Arran Walker 196 Sep 11, 2021
A Go filesystem package for working with files and directories

Stowage A Go filesystem package for working with files and directories, it features a simple API with support for the common files and directories ope

null 19 May 28, 2021
Golang PDF library for creating and processing PDF files (pure go)

UniPDF - PDF for Go UniDoc UniPDF is a PDF library for Go (golang) with capabilities for creating and reading, processing PDF files. The library is wr

UniDoc 1.4k Sep 22, 2021
Plik is a scalable & friendly temporary file upload system ( wetransfer like ) in golang.

Want to chat with us ? Telegram channel : https://t.me/plik_root_gg Plik Plik is a scalable & friendly temporary file upload system ( wetransfer like

root.gg 732 Sep 18, 2021
Run a command when files change

Reflex Reflex is a small tool to watch a directory and rerun a command when certain files change. It's great for automatically running compile/lint/te

Caleb Spare 2.4k Sep 11, 2021
Embed arbitrary resources into a go executable at runtime, after the executable has been built.

ember Ember is a lightweight library and tool for embedding arbitrary resources into a go executable at runtime. The resources don't need to exist at

null 47 Aug 15, 2021
A PDF processor written in Go.

pdfcpu: a Go PDF processor pdfcpu is a PDF processing library written in Go supporting encryption. It provides both an API and a CLI. Supported are al

pdfcpu 2.6k Sep 25, 2021
filesystem for golang

filesystem filesystem for golang installation go get github.com/go-component/filesystem import import "github.com/go-component/filesystem" Usage sup

null 4 Jul 9, 2021
Encrypted overlay filesystem written in Go

An encrypted overlay filesystem written in Go. Official website: https://nuetzlich.net/gocryptfs (markdown source). gocryptfs is built on top the exce

null 2k Sep 26, 2021
gsheet is a CLI tool (and Golang package) for piping csv data to and from Google Sheets

gsheet Table of Contents Introduction Why? Installation Authentication and Authorization What about OAuth authentication? CLI Usage Sheet commands Dri

chris 13 Aug 5, 2021
Takes an input http.FileSystem (likely at go generate time) and generates Go code that statically implements it.

vfsgen Package vfsgen takes an http.FileSystem (likely at go generate time) and generates Go code that statically implements the provided http.FileSys

null 932 Sep 10, 2021
Package cae implements PHP-like Compression and Archive Extensions.

Compression and Archive Extensions 中文文档 Package cae implements PHP-like Compression and Archive Extensions. But this package has some modifications de

ᴜɴᴋɴᴡᴏɴ 35 Sep 17, 2021
Pluggable, extensible virtual file system for Go

vfs Package vfs provides a pluggable, extensible, and opinionated set of file system functionality for Go across a number of file system types such as

C2FO 125 Sep 17, 2021
A FileSystem Abstraction System for Go

A FileSystem Abstraction System for Go Overview Afero is a filesystem framework providing a simple, uniform and universal API interacting with any fil

Steve Francia 4k Sep 24, 2021
A dead simple tool to rename your files for smooth web access!

ffw - Friendly Files for the Web Easily rename files from a folder to be compatible with the web Run ffw and that's it! Installation on macOs brew tap

Vincent Gschwend 3 May 13, 2021
🏵 Gee is tool of stdin to each files and stdout

Gee is tool of stdin to each files and stdout. It is similar to the tee command, but there are more functions for convenience. In addition, it was written as go. which provides output to stdout and files.

HAHWUL 38 Aug 31, 2021
Golang wrapper for Exiftool : extract as much metadata as possible (EXIF, ...) from files (pictures, pdf, office documents, ...)

go-exiftool go-exiftool is a golang library that wraps ExifTool. ExifTool's purpose is to extract as much metadata as possible (EXIF, IPTC, XMP, GPS,

null 79 Sep 13, 2021
Download an upload large files to Google Drive (API v3)

gdriver gdriver is a command-line tool, written in Go, used for uploading and downloading large personal files from Google Drive (API v3). The tool pr

Marcin Tojek 60 Sep 4, 2021