tar

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 12 Imported by: 21

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 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