Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/compression/compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ var (
// Zstd:chunked compression.
ZstdChunked = internal.NewAlgorithm(types.ZstdChunkedAlgorithmName, types.ZstdAlgorithmName, /* Note: InternalUnstableUndocumentedMIMEQuestionMark is not ZstdChunkedAlgorithmName */
nil, ZstdDecompressor, compressor.ZstdCompressor)
// Squashfs compression.
Squashfs = internal.NewAlgorithm(types.SquashfsAlgorithmName, types.SquashfsAlgorithmName,
[]byte{0x68, 0x73, 0x71, 0x73}, SquashfsDecompressor, nil)

compressionAlgorithms = map[string]Algorithm{
Gzip.Name(): Gzip,
Bzip2.Name(): Bzip2,
Xz.Name(): Xz,
Zstd.Name(): Zstd,
ZstdChunked.Name(): ZstdChunked,
Squashfs.Name(): Squashfs,
}
)

Expand Down Expand Up @@ -77,6 +81,11 @@ func XzDecompressor(r io.Reader) (io.ReadCloser, error) {
return ioutil.NopCloser(r), nil
}

// SquashfsDecompressor is a DecompressorFunc for the squashfs compression algorithm.
func SquashfsDecompressor(r io.Reader) (io.ReadCloser, error) {
return ioutil.NopCloser(r), nil
}

// gzipCompressor is a CompressorFunc for the gzip compression algorithm.
func gzipCompressor(r io.Writer, metadata map[string]string, level *int) (io.WriteCloser, error) {
if level != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/compression/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ const (
// will actually be available. (In fact it is intended for this types package not to depend
// on any of the implementations.)
ZstdChunkedAlgorithmName = "zstd:chunked"
// SquashfsAlgorithName is the name used by pkg/compression.Squashfs
// NOTE: Importing only this /types package does not inherently guarantee a Squashfs algorithm
// will actually be available. (In fact it is intended for this types package not to depend
// on any of the implementations.)
SquashfsAlgorithmName = "squashfs"
)