unarchiver

package
v0.0.0-...-cc320b4 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Unarchiver)

Option configures an Unarchiver.

func WithUntrustedSource

func WithUntrustedSource() Option

WithUntrustedSource marks the archive as coming from an untrusted source, so every extracted path, symlink target, and hardlink target is confined under the destination root and anything that would escape aborts extraction. Use it for untrusted archives such as private ingredient wheels.

It is off by default: trusted Platform artifacts may legitimately contain absolute symlinks (for example into /usr/share), which would otherwise be rejected.

type Unarchiver

type Unarchiver struct {
	archives.Extraction
	// contains filtered or unexported fields
}

func NewTarGz

func NewTarGz(opts ...Option) Unarchiver

func NewZip

func NewZip(opts ...Option) Unarchiver

func (*Unarchiver) PrepareUnpacking

func (ua *Unarchiver) PrepareUnpacking(source, destination string) (archiveFile *os.File, err error)

PrepareUnpacking prepares the destination directory and the archive for unpacking Returns the opened file

func (*Unarchiver) Unarchive

func (ua *Unarchiver) Unarchive(archiveStream io.Reader, destination string) error

Unarchive unarchives an archive file and unpacks it in `destination`. For an archive from an untrusted source (see WithUntrustedSource), every entry path, symlink target, and hardlink target is confined under destination and anything that would escape aborts extraction; otherwise paths are trusted as-is.

Jump to

Keyboard shortcuts

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