Conversation
Wires github.com/klauspost/compress/zstd into the tar path alongside gzip, bzip2 and xz. The .tar.zst extension routes through detectFormat and content-sniffed zstd (magic 0.2.0 already reports it) is opened as tar.zst. The decoder runs with concurrency 1 so it stays synchronous like the other decompressors. Closes #23
There was a problem hiding this comment.
Pull request overview
Adds support for zstd-compressed tar archives (.tar.zst) by wiring github.com/klauspost/compress/zstd into the existing TAR decompression pipeline, aligning behavior with existing gzip/bzip2/xz handling and extending detection, tests, and documentation accordingly.
Changes:
- Add
.tar.zstfilename detection andzstdcontent-sniff mapping to the TAR format selection logic. - Implement zstd decompression in
openTarusingklauspost/compress/zstd. - Extend tests and README to cover and document
.tar.zstand zstd content sniffing.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tar.go | Adds a zstd decompression branch in the TAR reader path. |
| archives.go | Adds .tar.zst format constant, extension detection, and magic-format mapping for zstd. |
| archives_test.go | Adds .tar.zst detection test and a zstd-compressed tar fixture for content sniffing tests. |
| README.md | Documents .tar.zst support and zstd content sniffing. |
| go.mod | Adds github.com/klauspost/compress dependency. |
| go.sum | Records checksums for the new dependency. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires
github.com/klauspost/compress/zstdinto the tar path alongside gzip, bzip2 and xz. Pure Go, no cgo, same shape as the existing xz case..tar.zstindetectFormatzstdinarchiveFormatfor the content-sniff fallback (magic 0.2.0 already reports it)openTargets azstdcase; the decoder runs withWithDecoderConcurrency(1)so it stays synchronous like the other decompressors and doesn't spawn background goroutines per openCloses #23