unarchiver

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveItem

type ArchiveItem interface {
	os.FileInfo
	FullName() string
	LinkName() string
	IsHardLink() bool // Special item type not represented in os.FileInfo.Mode
	Content() io.Reader
}

ArchiveItem represent one item within an archive. The name and attributes are provided as an os.FileInfo, and the content if any is accessible through an io.Reader.

type Unarchiver

type Unarchiver interface {
	// NextItem returns the next item in the archive. The item returned, and
	// specifically its content,  may become invalid on the next call to
	// NextItem() and should not be used after that point.
	NextItem() (item ArchiveItem, err error)
}

Unarchiver defines an common interface for accessing the content of an archive in a sequential fashion (for extraction purposes).

func New

func New(r io.Reader) (u Unarchiver, err error)

New creates and returns a new unarchiver capable of extracting the content of the stream r. The format is determined automatically based on the first few bytes of the stream. Supported formats include zip, tar.gz and tar.bz2, each of which as a recognizable signature prefix. If prefix is not recognized, the format is assumed to be a raw tar archive, the only supported format without a recognizable signature.

Jump to

Keyboard shortcuts

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