Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ulikunitz/xz
Pure golang package for reading and writing xz-compressed files
https://github.com/ulikunitz/xz
compression decompression go xz
Last synced: 3 days ago
JSON representation
Pure golang package for reading and writing xz-compressed files
- Host: GitHub
- URL: https://github.com/ulikunitz/xz
- Owner: ulikunitz
- License: other
- Created: 2014-08-15T19:41:21.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-09-21T10:14:30.000Z (3 months ago)
- Last Synced: 2024-10-29T19:59:30.754Z (about 1 month ago)
- Topics: compression, decompression, go, xz
- Language: Go
- Homepage:
- Size: 10 MB
- Stars: 481
- Watchers: 16
- Forks: 45
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-go - xz - Pure golang package for reading and writing xz-compressed files. (Miscellaneous / Uncategorized)
- zero-alloc-awesome-go - xz - Pure golang package for reading and writing xz-compressed files. (Miscellaneous / Uncategorized)
- awesome-go-extra - xz - compressed files|385|32|14|2014-08-15T19:41:21Z|2022-08-02T10:58:32Z| (Microsoft Office / Uncategorized)
README
# Package xz
This Go language package supports the reading and writing of xz
compressed streams. It includes also a gxz command for compressing and
decompressing data. The package is completely written in Go and doesn't
have any dependency on any C code.The package is currently under development. There might be bugs and APIs
are not considered stable. At this time the package cannot compete with
the xz tool regarding compression speed and size. The algorithms there
have been developed over a long time and are highly optimized. However
there are a number of improvements planned and I'm very optimistic about
parallel compression and decompression. Stay tuned!## Using the API
The following example program shows how to use the API.
```go
package mainimport (
"bytes"
"io"
"log"
"os""github.com/ulikunitz/xz"
)func main() {
const text = "The quick brown fox jumps over the lazy dog.\n"
var buf bytes.Buffer
// compress text
w, err := xz.NewWriter(&buf)
if err != nil {
log.Fatalf("xz.NewWriter error %s", err)
}
if _, err := io.WriteString(w, text); err != nil {
log.Fatalf("WriteString error %s", err)
}
if err := w.Close(); err != nil {
log.Fatalf("w.Close error %s", err)
}
// decompress buffer and write output to stdout
r, err := xz.NewReader(&buf)
if err != nil {
log.Fatalf("NewReader error %s", err)
}
if _, err = io.Copy(os.Stdout, r); err != nil {
log.Fatalf("io.Copy error %s", err)
}
}
```## Documentation
You can find the full documentation at [pkg.go.dev](https://pkg.go.dev/github.com/ulikunitz/xz).
## Using the gxz compression tool
The package includes a gxz command line utility for compression and
decompression.Use following command for installation:
$ go get github.com/ulikunitz/xz/cmd/gxz
To test it call the following command.
$ gxz bigfile
After some time a much smaller file bigfile.xz will replace bigfile.
To decompress it use the following command.$ gxz -d bigfile.xz
## Security & Vulnerabilities
The security policy is documented in [SECURITY.md](SECURITY.md).
The software is not affected by the supply chain attack on the original xz
implementation, [CVE-2024-3094](https://nvd.nist.gov/vuln/detail/CVE-2024-3094).
This implementation doesn't share any files with the original xz implementation
and no patches or pull requests are accepted without a review.All security advisories for this project are published under
[github.com/ulikunitz/xz/security/advisories](https://github.com/ulikunitz/xz/security/advisories?state=published).