utils

package
v5.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTarFromSrc

func CreateTarFromSrc(source string, dest string) error

Creates a new tar file and writes bytes from io.ReadCloser

func ExecCmd

func ExecCmd(name string, args ...string) (string, error)

ExecCmd executes a command with args and returns its output as a string along with an error, if any.

func ExecCmdWithStdStreams

func ExecCmdWithStdStreams(stdin io.Reader, stdout, stderr io.Writer, env []string, name string, args ...string) error

ExecCmdWithStdStreams execute a command with the specified standard streams.

func GetRandomPort

func GetRandomPort() (int, error)

Find a random, open port on the host.

func GuardedRemoveAll

func GuardedRemoveAll(path string) error

GuardedRemoveAll functions much like os.RemoveAll but will not delete certain catastrophic paths.

func ProgressBar

func ProgressBar(prefix string, size int64, onComplete string) (*mpb.Progress, *mpb.Bar)

func Tar

func Tar(source string) (io.ReadCloser, error)

Tar creates a tarball from source and returns a readcloser of it

func TarChrootToFilesystem

func TarChrootToFilesystem(source string, tarball *os.File) error

TarChrootToFilesystem creates a tarball from source and writes to an os.file provided while chrooted to the source.

func TarToFilesystem

func TarToFilesystem(source string, tarball *os.File) error

TarToFilesystem creates a tarball from source and writes to an os.file provided

func TarWithChroot

func TarWithChroot(source string) (io.ReadCloser, error)

TarWithChroot creates a tarball from source and returns a readcloser of it while chrooted to the source.

func UntarToFileSystem

func UntarToFileSystem(dest string, tarball *os.File, options *archive.TarOptions) error

UntarToFileSystem untars an os.file of a tarball to a destination in the filesystem

Types

This section is empty.

Jump to

Keyboard shortcuts

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