MCPcopy
hub / github.com/containerd/containerd / CompressStream

Function CompressStream

pkg/archive/compression/compression.go:244–255  ·  view source on GitHub ↗

CompressStream compresses the dest with specified compression algorithm.

(dest io.Writer, compression Compression)

Source from the content-addressed store, hash-verified

242
243// CompressStream compresses the dest with specified compression algorithm.
244func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error) {
245 switch compression {
246 case Uncompressed:
247 return &writeCloserWrapper{dest, nil}, nil
248 case Gzip:
249 return gzip.NewWriter(dest), nil
250 case Zstd:
251 return zstd.NewWriter(dest)
252 default:
253 return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension())
254 }
255}
256
257// Extension returns the extension of a file that uses the specified compression algorithm.
258func (compression *Compression) Extension() string {

Callers 7

createContentFunction · 0.92
compressBlobFunction · 0.92
LayerConvertFuncFunction · 0.92
CompareMethod · 0.92
CompareMethod · 0.92
CompareMethod · 0.92
testCompressFunction · 0.85

Calls 1

ExtensionMethod · 0.80

Tested by 2

createContentFunction · 0.74
testCompressFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…