tarutil

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptySubdir = errors.New("empty tarball subdirectory")

Functions

func Extract

func Extract(r io.Reader, dir string, opts ...Opt) error

Extract reads the tarball from r and writes it into dir. This was copied and modified from golang.org/x/build/internal/untar.

func IsGzipped

func IsGzipped(o *Opts)

func Subdir added in v0.9.0

func Subdir(r io.Reader, subdir string, opts ...Opt) io.ReadCloser

Subdir reads the tarball from r and and streams the files in the given subdirectory to the returned io.ReadCloser as a tarball with the subdirectory's path trimmed from each file's name.

If the subdirectory is empty or non-existent, the returned io.ReadCloser is closed with ErrEmptySubdir.

Types

type Opt

type Opt func(*Opts)

type Opts

type Opts struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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