Documentation ¶
Overview ¶
Package archive provides common types and functions for archive processing.
Index ¶
- func Canonicalize(dst io.Writer, src io.Reader, f Format) error
- func CanonicalizeTar(tr *tar.Reader, tw *tar.Writer) error
- func CanonicalizeZip(zr *zip.Reader, zw *zip.Writer) error
- func ExtractTar(tr *tar.Reader, fs billy.Filesystem, opt ExtractOptions) error
- type ContentSummary
- type ExtractOptions
- type Format
- type TarEntry
- type ZipEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Canonicalize ¶
Canonicalize selects and applies the canonicalization routine for the given archive format.
func CanonicalizeTar ¶
CanonicalizeTar strips volatile metadata and re-writes the provided archive in a canonical form.
func CanonicalizeZip ¶
CanonicalizeZip strips volatile metadata and rewrites the provided archive in a canonical form.
func ExtractTar ¶
func ExtractTar(tr *tar.Reader, fs billy.Filesystem, opt ExtractOptions) error
ExtractTar writes the contents of a tar to a filesystem.
Types ¶
type ContentSummary ¶
ContentSummary is a summary of rebuild-relevant features of an archive.
func NewContentSummary ¶
func NewContentSummary(src io.Reader, f Format) (*ContentSummary, error)
NewContentSummary constructs a ContentSummary for the given archive format.
func NewContentSummaryFromTar ¶
func NewContentSummaryFromTar(tr *tar.Reader) (*ContentSummary, error)
NewContentSummaryFromTar returns a ContentSummary for a tar archive.
func NewContentSummaryFromZip ¶
func NewContentSummaryFromZip(zr *zip.Reader) (*ContentSummary, error)
NewContentSummaryFromZip returns a ContentSummary for a zip archive.
func (*ContentSummary) Diff ¶
func (cs *ContentSummary) Diff(other *ContentSummary) (leftOnly, diffs, rightOnly []string)
Diff returns the files that are only in this summary, the files that are in both summaries but have different hashes, and the files that are only in the other summary.
type ExtractOptions ¶
type ExtractOptions struct { // SubDir is a directory within the TAR to extract relative to the provided filesystem. SubDir string }
ExtractOptions provides options modifying ExtractTar behavior.