Package Usage: go: github.com/mholt/archiver/v3
Package archiver facilitates convenient, cross-platform, high-level archival
and compression operations for a variety of formats and compression algorithms.
This package and its dependencies are written in pure Go (not cgo) and
have no external dependencies, so they should run on all major platforms.
(It also comes with a command for CLI use in the cmd/arc folder.)
Each supported format or algorithm has a unique type definition that
implements the interfaces corresponding to the tasks they perform. For
example, the Tar type implements Reader, Writer, Archiver, Unarchiver,
Walker, and several other interfaces.
The most common functions are implemented at the package level for
convenience: Archive, Unarchive, Walk, Extract, CompressFile, and
DecompressFile. With these, the format type is chosen implicitly,
and a sane default configuration is used.
To customize a format's configuration, create an instance of its struct
with its fields set to the desired values. You can also use and customize
the handy Default* (replace the wildcard with the format's type name)
for a quick, one-off instance of the format's type.
To obtain a new instance of a format's struct with the default config, use
the provided New*() functions. This is not required, however. An empty
struct of any type, for example &Zip{} is perfectly valid, so you may
create the structs manually, too. The examples on this page show how
either may be done.
See the examples in this package for an idea of how to wield this package
for common tasks. Most of the examples which are specific to a certain
format type, for example Zip, can be applied to other types that implement
the same interfaces. For example, using Zip is very similar to using Tar
or TarGz (etc), and using Gz is very similar to using Sz or Xz (etc).
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, to prevent confusion later on. If you absolutely need a different
file extension, you may rename the file afterward.
Values in this package are NOT safe for concurrent use. There is no
performance benefit of reusing them, and since they may contain important
state (especially while walking, reading, or writing), it is NOT
recommended to reuse values from this package or change their configuration
after they are in use.
11 versions
Latest release: over 3 years ago
1,162 dependent packages
View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/mholt/archiver/v3
Dependent Repos 1
radiofrance/dib
An opinionated docker image builderSize: 3.61 MB - Last synced: 7 days ago - Pushed: 7 days ago
