compression

package
v0.46.14 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor added in v0.45.0

type Compressor struct {
	Config
	// contains filtered or unexported fields
}

func (*Compressor) Close added in v0.45.0

func (c *Compressor) Close() error

Close closes encoder and decoder, returns any error occurred.

func (*Compressor) Compress added in v0.45.0

func (c *Compressor) Compress(data []byte) []byte

Compress compresses data if compression is enabled and returns data untouched otherwise.

func (*Compressor) Decompress added in v0.45.0

func (c *Compressor) Decompress(data []byte) ([]byte, error)

Decompress decompresses data if it starts with the magic and returns data untouched otherwise.

func (*Compressor) Init added in v0.45.0

func (c *Compressor) Init() error

Init initializes compression routines.

func (*Compressor) NeedsCompression added in v0.46.0

func (c *Compressor) NeedsCompression(obj *objectSDK.Object) bool

NeedsCompression returns true if the object should be compressed. For an object to be compressed 2 conditions must hold: 1. Compression is enabled in settings. 2. Object MIME Content-Type is allowed for compression.

type Config

type Config struct {
	Enabled                    bool
	UncompressableContentTypes []string
	Level                      Level

	EstimateCompressibility          bool
	EstimateCompressibilityThreshold float64
}

Config represents common compression-related configuration.

func (*Config) HasValidCompressionLevel added in v0.45.0

func (c *Config) HasValidCompressionLevel() bool

type Level added in v0.45.0

type Level string
const (
	LevelDefault      Level = ""
	LevelOptimal      Level = "optimal"
	LevelFastest      Level = "fastest"
	LevelSmallestSize Level = "smallest_size"
)

Jump to

Keyboard shortcuts

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