archive

package
v0.10.0-nightly Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBufferSize = 5 << 20

DefaultBufferSize defines a default buffer size for reading and writing the archives.

Variables

This section is empty.

Functions

func NewPackCmd added in v0.6.0

func NewPackCmd() *cobra.Command

func NewUnpackCmd added in v0.6.0

func NewUnpackCmd() *cobra.Command

Types

type CompressionType

type CompressionType int

CompressionType defines a custom type the represents a compression type value.

const (
	NoCompression CompressionType = iota
	Gzip
	Zstd
)

func (CompressionType) Extension

func (ct CompressionType) Extension() string

Extension returns the archive name extension representing the compression type.

func (CompressionType) FromString

func (ct CompressionType) FromString(s string) CompressionType

FromString resolves and returns the CompressionType value from the provided string. If string value is unknows or invalid the NoCompression will be used.

func (CompressionType) Reader

func (ct CompressionType) Reader(r io.Reader) (io.Reader, error)

func (CompressionType) Writer

func (ct CompressionType) Writer(w io.Writer) (io.WriteCloser, error)

type Tar

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

func NewTar

func NewTar(bufferSize int, ct CompressionType) *Tar

func (*Tar) Pack

func (t *Tar) Pack(files []string, w io.Writer) error

func (*Tar) PackToFile

func (t *Tar) PackToFile(files []string, outputPath string) error

func (*Tar) Unpack

func (t *Tar) Unpack(r io.Reader, outputPath string) error

func (*Tar) UnpackFromFile

func (t *Tar) UnpackFromFile(archivePath string, outputPath string) error

Jump to

Keyboard shortcuts

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