Documentation ¶
Index ¶
- Constants
- func CleanDigestAlgorithmName(name string) string
- func ContentsFromZip(archivePath string, paths ...string) (map[string]string, error)
- func ExtractFromZipToUniqueTempFile(archivePath, dir string, paths ...string) (map[string]Opener, error)
- func ExtractGlobsFromTarToUniqueTempFile(archivePath, dir string, globs ...string) (map[string]Opener, error)
- func GlobMatch(pattern, name string) bool
- func Hashers(names ...string) ([]crypto.Hash, error)
- func NewDigestsFromFile(closer io.ReadCloser, hashes []crypto.Hash) ([]file.Digest, error)
- func NormalizeHashes(hashes []crypto.Hash) []crypto.Hash
- func TraverseFilesInZip(archivePath string, visitor func(*zip.File) error, paths ...string) error
- func UnzipToDir(archivePath, targetDir string) error
- type Opener
- type ZipFileManifest
- type ZipReadCloser
Constants ¶
const ( KB = 1 << (10 * iota) MB GB )
Variables ¶
This section is empty.
Functions ¶
func CleanDigestAlgorithmName ¶ added in v0.85.0
func ContentsFromZip ¶
ContentsFromZip extracts select paths for the given archive and returns a set of string contents for each path.
func ExtractFromZipToUniqueTempFile ¶
func ExtractFromZipToUniqueTempFile(archivePath, dir string, paths ...string) (map[string]Opener, error)
ExtractFromZipToUniqueTempFile extracts select paths for the given archive to a temporary directory, returning file openers for each file extracted.
func ExtractGlobsFromTarToUniqueTempFile ¶ added in v0.35.0
func ExtractGlobsFromTarToUniqueTempFile(archivePath, dir string, globs ...string) (map[string]Opener, error)
ExtractGlobsFromTarToUniqueTempFile extracts paths matching the given globs within the given archive to a temporary directory, returning file openers for each file extracted.
func GlobMatch ¶
GlobMatch evaluates the given glob pattern against the given "name" string, indicating if there is a match or not. Source: https://research.swtch.com/glob.go
func NewDigestsFromFile ¶ added in v0.85.0
func TraverseFilesInZip ¶
TraverseFilesInZip enumerates all paths stored within a zip archive using the visitor pattern.
func UnzipToDir ¶
UnzipToDir extracts a zip archive to a target directory.
Types ¶
type Opener ¶ added in v0.4.0
type Opener struct {
// contains filtered or unexported fields
}
Opener is an object that stores a path to later be opened as a file.
type ZipFileManifest ¶
ZipFileManifest is a collection of paths and their file metadata.
func NewZipFileManifest ¶
func NewZipFileManifest(archivePath string) (ZipFileManifest, error)
NewZipFileManifest creates and returns a new ZipFileManifest populated with path and metadata from the given zip archive path.
type ZipReadCloser ¶ added in v0.17.0
ZipReadCloser is a drop-in replacement for zip.ReadCloser (from zip.OpenReader) that additionally considers zips that have bytes prefixed to the front of the archive (common with self-extracting jars).
func OpenZip ¶ added in v0.17.0
func OpenZip(filepath string) (*ZipReadCloser, error)
OpenZip provides a ZipReadCloser for the given filepath.