archive

package
v0.750.8 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArchiveTar is a tar ball.
	ArchiveTar = "tar"
	// ArchiveTgz is a gzipped tar ball.
	ArchiveTgz = "tgz"
	// ArchiveZip is a zip file.
	ArchiveZip = "zip"
	// ArchiveUnknown represents an unknown archive type.
	ArchiveUnknown = "unknown"
)

Variables

This section is empty.

Functions

func DryRunLength

func DryRunLength(
	aw ArchiveWriter,
	files []FileEntry,
) (int64, error)

DryRunLength returns the length of the archive file that would be created if the files were written to the archive.

Types

type ArchiveType

type ArchiveType string

ArchiveType currently includes tgz and zip.

type ArchiveWriter

type ArchiveWriter interface {
	WriteHeader(path string, size int64) error
	Write(b []byte) (int, error)
	Close() error
	DryRunEnabled() bool
	DryRunLength(path string, size int64) (int64, error)
	DryRunClose() (int64, error)
}

ArchiveWriter defines an interface to create an archive file.

func NewArchiveWriter

func NewArchiveWriter(w io.Writer, archiveType ArchiveType) (ArchiveWriter, error)

NewArchiveWriter returns a new ArchiveWriter for archiveType that writes to w.

type FileEntry

type FileEntry struct {
	// Path is the path of the file in the archive.
	Path string
	// Size is the size of the file in bytes.
	Size int64
}

FileEntry represents a file in an archive.

Jump to

Keyboard shortcuts

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