Documentation
¶
Index ¶
Constants ¶
View Source
const (
EncodingDeflate = "deflate"
)
View Source
const (
EncodingGzip = "gzip"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compressor ¶
type Compressor interface { Compress(w io.Writer, data []byte) (int, error) Decompress(reader io.ReadCloser) (io.ReadCloser, error) }
Compressor abstracts the interface for a compression handler.
type Compressors ¶
type Compressors struct {
// contains filtered or unexported fields
}
func NewCompressors ¶
func NewCompressors() *Compressors
NewCompressors create a Compressors instance.
func (Compressors) AcceptEncoding ¶
func (c Compressors) AcceptEncoding() string
AcceptEncoding returns the Accept-Encoding header with supported compression encodings.
func (Compressors) Decompress ¶
func (c Compressors) Decompress(reader io.ReadCloser, encoding string) (io.ReadCloser, error)
Decompress reads and decompresses the reader with equivalent the content encoding.
func (Compressors) IsEncodingSupported ¶
func (c Compressors) IsEncodingSupported(encoding string) bool
IsEncodingSupported checks if the input encoding is supported.
type DeflateCompressor ¶
type DeflateCompressor struct{}
DeflateCompressor implements the compression handler for deflate encoding.
func (DeflateCompressor) Decompress ¶
func (dc DeflateCompressor) Decompress(reader io.ReadCloser) (io.ReadCloser, error)
Decompress the reader content with gzip encoding.
type GzipCompressor ¶
type GzipCompressor struct{}
GzipCompressor implements the compression handler for gzip encoding.
func (GzipCompressor) Decompress ¶
func (gc GzipCompressor) Decompress(reader io.ReadCloser) (io.ReadCloser, error)
Decompress the reader content with gzip encoding.
Click to show internal directories.
Click to hide internal directories.