tar

package module
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: BSD-3-Clause Imports: 12 Imported by: 24

Documentation

Overview

Package tar provides ways to manage tarball files.

Index

Constants

View Source
const (
	// DefaultMaxUntarSize defines the default (100MB) max amount of bytes that Untar will process.
	DefaultMaxUntarSize = 100 << (10 * 2)

	// UnlimitedUntarSize defines the value which disables untar size checks for maxUntarSize.
	UnlimitedUntarSize = -1
)

Variables

This section is empty.

Functions

func Untar

func Untar(r io.Reader, dir string, inOpts ...TarOption) (err error)

Untar reads the gzip-compressed tar file from r and writes it into dir.

If dir is a relative path, it cannot ascend from the current working dir. If dir exists, it must be a directory.

Types

type TarOption

type TarOption func(*tarOpts)

TarOption represents options to be applied to Tar.

func WithMaxUntarSize

func WithMaxUntarSize(max int) TarOption

WithMaxUntarSize sets the limit size for archives being decompressed by Untar. When max is equal or less than 0 disables size checks.

func WithSkipGzip added in v0.8.0

func WithSkipGzip() TarOption

WithSkipGzip allows for un-taring plain tar files too, that aren't gzipped.

func WithSkipSymlinks() TarOption

WithSkipSymlinks allows for symlinks to be present in the tarball and skips them when decompressing.

Jump to

Keyboard shortcuts

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