compression

package
v0.0.0-...-5a94a59 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginLeptonProcess

func BeginLeptonProcess(in io.Reader) (*exec.Cmd, io.ReadCloser)

func CheckCompression

func CheckCompression()

func Compress

func Compress(path string, out io.Writer, in io.Reader, hs *utils.HasherSizer) string

func VerifiedCompression

func VerifiedCompression(c Compression, out io.Writer, read io.Reader, hs *utils.HasherSizer)

compress data while also verifying that the stream will decompress back to the same data but without buffering - do the whole thing streaming

Types

type Compression

type Compression interface {
	// these two should only return once they are completely finished
	// behavior: panic on IO error, panic on compression failure if thought to be infallible, return error on failable compression failure
	Compress(out io.Writer, in io.Reader) error

	Decompress(in io.Reader) io.ReadCloser

	AlgName() string

	// can this compression fail if fed unexpected input?
	// a general purpose compression like zstd or xz should return false, since they work on any arbitrary input bytes
	// special purpose compression such as lepton should return true, since it only works on well-formed jpgs
	Fallible() bool

	DecompressionTrollBashCommandIncludingThePipe() string
}

func ByAlgName

func ByAlgName(algName string) Compression

type LeptonCompression

type LeptonCompression struct{}

func (*LeptonCompression) AlgName

func (n *LeptonCompression) AlgName() string

func (*LeptonCompression) Compress

func (n *LeptonCompression) Compress(out io.Writer, in io.Reader) error

func (*LeptonCompression) Decompress

func (n *LeptonCompression) Decompress(in io.Reader) io.ReadCloser

func (*LeptonCompression) DecompressionTrollBashCommandIncludingThePipe

func (n *LeptonCompression) DecompressionTrollBashCommandIncludingThePipe() string

func (*LeptonCompression) Fallible

func (n *LeptonCompression) Fallible() bool

type NoCompression

type NoCompression struct{}

func (*NoCompression) AlgName

func (n *NoCompression) AlgName() string

func (*NoCompression) Compress

func (n *NoCompression) Compress(out io.Writer, in io.Reader) error

func (*NoCompression) Decompress

func (n *NoCompression) Decompress(in io.Reader) io.ReadCloser

func (*NoCompression) DecompressionTrollBashCommandIncludingThePipe

func (n *NoCompression) DecompressionTrollBashCommandIncludingThePipe() string

func (*NoCompression) Fallible

func (n *NoCompression) Fallible() bool

type WrappedReadCloserHackToAvoidZombieProcess

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

func (*WrappedReadCloserHackToAvoidZombieProcess) Close

func (*WrappedReadCloserHackToAvoidZombieProcess) Read

type ZstdCompression

type ZstdCompression struct{}

func (*ZstdCompression) AlgName

func (n *ZstdCompression) AlgName() string

func (*ZstdCompression) Compress

func (n *ZstdCompression) Compress(out io.Writer, in io.Reader) error

func (*ZstdCompression) Decompress

func (n *ZstdCompression) Decompress(in io.Reader) io.ReadCloser

func (*ZstdCompression) DecompressionTrollBashCommandIncludingThePipe

func (n *ZstdCompression) DecompressionTrollBashCommandIncludingThePipe() string

func (*ZstdCompression) Fallible

func (n *ZstdCompression) Fallible() bool

Jump to

Keyboard shortcuts

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