Documentation
¶
Index ¶
- func CreateTar(tarFile io.Writer, files []string, opts *Opts) error
- func ExtractDir(tarFile io.Reader, dir string, opts *Opts) error
- func ListArchive(tarFile io.Reader) error
- func NoFilter(hdr *tar.Header) bool
- func SafeFilter(hdr *tar.Header) bool
- func VerboseFilter(hdr *tar.Header) bool
- func VerboseLogFilter(hdr *tar.Header) bool
- type Filter
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDir ¶
ExtractDir extracts all the contents of the tar file to the given directory.
func ListArchive ¶
ListArchive lists the contents of the given tar archive.
func SafeFilter ¶
SafeFilter filters out all files which are not regular and not directories. It also sets appropriate permissions.
func VerboseFilter ¶
VerboseFilter prints the name of every file.
func VerboseLogFilter ¶
VerboseLogFilter logs the name of every file.
Types ¶
type Filter ¶
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.
type Opts ¶
type Opts struct {
// Filters are 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.
Filters []Filter
// By default, when creating a tar archive, all directories are walked
// to include all sub-directories. Set to true to prevent this
// behavior.
NoRecursion bool
// Change to this directory before any operations. This is equivalent
// to "tar -C DIR".
ChangeDirectory string
}
Opts contains options for creating and extracting tar files.
Click to show internal directories.
Click to hide internal directories.