tarutil

package
v6.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTar

func CreateTar(tarFile io.Writer, files []string) error

CreateTar creates a new tar file with all the contents of a directory.

func CreateTarFilter

func CreateTarFilter(tarFile io.Writer, files []string, filters []Filter) error

CreateTarFilter creates a new tar file of the given files, with the given filter.

func ExtractDir

func ExtractDir(tarFile io.Reader, dir string) error

ExtractDir extracts all the contents of the tar file to the given directory.

func ExtractDirFilter

func ExtractDirFilter(tarFile io.Reader, dir string, filters []Filter) error

ExtractDirFilter extracts a tar file with the given filter.

func ListArchive

func ListArchive(tarFile io.Reader) error

ListArchive lists the contents of the given tar archive.

func NoFilter

func NoFilter(hdr *tar.Header) bool

NoFilter does not filter or modify any files.

func SafeFilter

func SafeFilter(hdr *tar.Header) bool

SafeFilter filters out all files which are not regular and not directories. It also sets sane permissions.

func VerboseFilter

func VerboseFilter(hdr *tar.Header) bool

VerboseFilter prints the name of every file.

func VerboseLogFilter

func VerboseLogFilter(hdr *tar.Header) bool

VerboseLogFilter logs the name of every file.

Types

type Filter

type Filter func(hdr *tar.Header) bool

Filter is applied to each file while creating or extracting a tar archive. The filter can modify the tar.Header struct. If the filter returns false, the file is omitted.

Jump to

Keyboard shortcuts

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