Compression levels does not apply for bzip2, xz, zstd, lz4, now we map then as best as we can.

This commit is contained in:
eleksir
2026-04-04 16:45:07 +03:00
parent f20f490c15
commit e063352252
4 changed files with 176 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ import (
// CreateTarXzStream takes a list of files and returns a reader that reads from an xz-compressed tar archive.
func CreateTarXzStream(ctx context.Context, filepaths []string) io.ReadCloser {
return createArchiveStream(ctx, filepaths, func(w io.Writer) (io.WriteCloser, error) {
// xz doesn't have a simple level parameter; use default compression.
// The compression level affects block size indirectly through the algorithm.
return xz.NewWriter(w)
})
}