package compression
import "github.com/moby/go-archive/compression"
Index ¶
- func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error)
- func DecompressStream(archive io.Reader) (io.ReadCloser, error)
- type Compression
Functions ¶
func CompressStream ¶
func CompressStream(dest io.Writer, compression Compression) (io.WriteCloser, error)
CompressStream compresses the dest with specified compression algorithm.
func DecompressStream ¶
func DecompressStream(archive io.Reader) (io.ReadCloser, error)
DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive.
Types ¶
type Compression ¶
type Compression int
Compression is the state represents if compressed or not.
const ( None Compression = 0 // None represents the uncompressed. Bzip2 Compression = 1 // Bzip2 is bzip2 compression algorithm. Gzip Compression = 2 // Gzip is gzip compression algorithm. Xz Compression = 3 // Xz is xz compression algorithm. Zstd Compression = 4 // Zstd is zstd compression algorithm. )
func Detect ¶
func Detect(source []byte) Compression
Detect detects the compression algorithm of the source.
func (*Compression) Extension ¶
func (c *Compression) Extension() string
Extension returns the extension of a file that uses the specified compression algorithm.
Source Files ¶
compression.go compression_detect.go
- Version
- v0.1.0 (latest)
- Published
- Apr 16, 2025
- Platform
- linux/amd64
- Imports
- 15 packages
- Last checked
- 2 weeks ago –
Tools for package owners.