unarchiver

package
v0.0.0-...-800c319 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: BSD-3-Clause Imports: 10 Imported by: 0

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