package compression

import "github.com/containerd/containerd/archive/compression"

Index

Functions

func CompressStream

func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error)

CompressStream compresses the dest with specified compression algorithm.

Types

type Compression

type Compression int

Compression is the state represents if compressed or not.

const (
	// Uncompressed represents the uncompressed.
	Uncompressed Compression = iota
	// Gzip is gzip compression algorithm.
	Gzip
	// Zstd is zstd compression algorithm.
	Zstd
)

func DetectCompression

func DetectCompression(source []byte) Compression

DetectCompression detects the compression algorithm of the source.

func (*Compression) Extension

func (compression *Compression) Extension() string

Extension returns the extension of a file that uses the specified compression algorithm.

type DecompressReadCloser

type DecompressReadCloser interface {
	io.ReadCloser
	// GetCompression returns the compress method which is used before decompressing
	GetCompression() Compression
}

DecompressReadCloser include the stream after decompress and the compress method detected.

func DecompressStream

func DecompressStream(archive io.Reader) (DecompressReadCloser, error)

DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive.

Source Files

compression.go

Version
v1.6.33
Published
Jun 5, 2024
Platform
linux/amd64
Imports
13 packages
Last checked
2 minutes ago

Tools for package owners.