compression

package
v0.38.6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enabled                    bool
	UncompressableContentTypes []string

	UseCompressEstimation       bool
	CompressEstimationThreshold float64
	// contains filtered or unexported fields
}

Config represents common compression-related configuration.

func (*Config) Close

func (c *Config) Close() error

Close closes encoder and decoder, returns any error occurred.

func (*Config) Compress

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

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

func (*Config) Decompress

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

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

func (*Config) Init

func (c *Config) Init() error

Init initializes compression routines.

func (*Config) NeedsCompression

func (c *Config) 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.

Jump to

Keyboard shortcuts

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