7z libraries for Go
The Go standard library has archive/zip and archive/tar but no 7z. The library to use is:
- sevenzip (
github.com/bodgit/sevenzip): a pure-Go reader with the same shape asarchive/zip. It supports LZMA, LZMA2, PPMd, BZip2, Deflate, Zstandard, Brotli, LZ4, the BCJ/BCJ2/ARM/ARM64 filters, AES-256 encryption, multi-volume and self-extracting archives, and implementsfs.FS. No cgo, no external programs.
There is no maintained pure-Go 7z writer. To create 7z archives from Go, run the 7z / 7zz command with os/exec, or write ZIP or .tar.xz instead (xz uses the same LZMA2 compression).
- sevenzip github.com/bodgit/sevenzip is a pure-Go library for reading 7z archives. How to install it, list and extract a 7z file, open encrypted.