compressors

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	Path() string                     // Path returns the path to the archive
	AddFile(name string, path string) // AddFile adds the file from path as name to the archive
	AddDirectory(path string)         // AddDirectory adds all files from within a directory
	Close() error                     // Close creates and closes the archive
}

Compressor defines the interface a compressor needs to implement

type TarballCompressor

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

TarballCompressor is used to create tgz files

func NewTarball

func NewTarball(path string) *TarballCompressor

NewTarball returns a new TarballCompressor instance

func (*TarballCompressor) AddDirectory added in v1.1.0

func (archive *TarballCompressor) AddDirectory(dirPath string)

AddDirectory adds all files from within a directory

func (*TarballCompressor) AddFile

func (archive *TarballCompressor) AddFile(name string, path string)

AddFile adds the file from path as name to the archive

If name is not specified, the basename of path is used

func (*TarballCompressor) Close

func (archive *TarballCompressor) Close() error

Close creates and closes the archive

func (*TarballCompressor) Path

func (archive *TarballCompressor) Path() string

Path returns the path to the tgz file

type ZipCompressor

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

ZipCompressor is used to create zip files

func NewZip

func NewZip(path string) *ZipCompressor

NewZip returns a new ZipCompressor instance

func (*ZipCompressor) AddDirectory added in v1.1.0

func (archive *ZipCompressor) AddDirectory(dirPath string)

AddDirectory adds all files from within a directory

func (*ZipCompressor) AddFile

func (archive *ZipCompressor) AddFile(name string, path string)

AddFile adds the file from path as name to the archive

If name is not specified, the basename of path is used

func (*ZipCompressor) Close

func (archive *ZipCompressor) Close() error

Close creates and closes the archive

func (*ZipCompressor) Path

func (archive *ZipCompressor) Path() string

Path returns the path to the zip file

Jump to

Keyboard shortcuts

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