gzipimpl

package
v0.63.0-rc.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package gzipimpl provides a set of functions for compressing with zlib / zstd / gzip

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a new GzipStrategy

Types

type GzipStrategy

type GzipStrategy struct {
	// contains filtered or unexported fields
}

GzipStrategy is the strategy for when serializer_compression_kind is gzip

func (*GzipStrategy) Compress

func (s *GzipStrategy) Compress(src []byte) (result []byte, err error)

Compress will compress the data with gzip

func (*GzipStrategy) CompressBound

func (s *GzipStrategy) CompressBound(sourceLen int) int

CompressBound returns the worst case size needed for a destination buffer when using gzip

The worst case expansion is a few bytes for the gzip file header, plus 5 bytes per 32 KiB block, or an expansion ratio of 0.015% for large files. The additional 18 bytes comes from the header (10 bytes) and trailer (8 bytes). There is no theoretical maximum to the header, but we don't set any extra header fields so it is safe to assume

Source: https://www.gnu.org/software/gzip/manual/html_node/Overview.html More details are in the linked RFC: https://www.ietf.org/rfc/rfc1952.txt

func (*GzipStrategy) ContentEncoding

func (s *GzipStrategy) ContentEncoding() string

ContentEncoding returns the content encoding value for gzip

func (*GzipStrategy) Decompress

func (s *GzipStrategy) Decompress(src []byte) ([]byte, error)

Decompress will decompress the data with gzip

func (*GzipStrategy) NewStreamCompressor

func (s *GzipStrategy) NewStreamCompressor(output *bytes.Buffer) compression.StreamCompressor

NewStreamCompressor returns a new gzip Writer

type Requires

type Requires struct {
	Level int
}

Requires contains the compression level for gzip compression

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL