Skip to content

Add zstd decompression for .tar.zst - #31

Merged
andrew merged 1 commit into
mainfrom
zstd
Aug 16, 2026
Merged

Add zstd decompression for .tar.zst#31
andrew merged 1 commit into
mainfrom
zstd

Conversation

@andrew

@andrew andrew commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Wires github.com/klauspost/compress/zstd into the tar path alongside gzip, bzip2 and xz. Pure Go, no cgo, same shape as the existing xz case.

  • .tar.zst in detectFormat
  • zstd in archiveFormat for the content-sniff fallback (magic 0.2.0 already reports it)
  • openTar gets a zstd case; the decoder runs with WithDecoderConcurrency(1) so it stays synchronous like the other decompressors and doesn't spawn background goroutines per open

Closes #23

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.zst filename detection and zstd content-sniff mapping to the TAR format selection logic.
  • Implement zstd decompression in openTar using klauspost/compress/zstd.
  • Extend tests and README to cover and document .tar.zst and 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.

Comment thread tar.go
@andrew andrew mentioned this pull request Aug 16, 2026
@andrew
andrew merged commit eb044c4 into main Aug 16, 2026
6 checks passed
@andrew
andrew deleted the zstd branch August 16, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add zstd decompression

2 participants