Documentation ¶
Overview ¶
Package archiver provides a service to archive part of the filesystem into tar archive
Index ¶
- Constants
- func Tar(ctx context.Context, paths <-chan FileItem, output io.Writer) error
- func TarGz(ctx context.Context, rootPath string, output io.Writer, ...) error
- func Untar(ctx context.Context, r io.Reader, rootPath string) error
- func UntarGz(ctx context.Context, input io.Reader, rootPath string) error
- func Walker(ctx context.Context, rootPath string, options ...WalkerOption) (<-chan FileItem, error)
- type FileItem
- type WalkerOption
Constants ¶
const OSPathSeparator = string(os.PathSeparator)
OSPathSeparator is the string version of the os.PathSeparator.
Variables ¶
This section is empty.
Functions ¶
func Tar ¶
Tar creates .tar archive and writes it to output for every item in paths channel
nolint: gocyclo
func TarGz ¶
func TarGz(ctx context.Context, rootPath string, output io.Writer, walkerOptions ...WalkerOption) error
TarGz produces .tar.gz archive of filesystem starting at rootPath.
func Untar ¶ added in v0.7.0
Untar extracts .tar archive from r into filesystem under rootPath.
nolint: gocyclo
Types ¶
type FileItem ¶
type FileItem struct { FullPath string RelPath string FileInfo os.FileInfo Link string Error error }
FileItem is unit of work for archive.
type WalkerOption ¶
type WalkerOption func(*walkerOptions)
WalkerOption configures Walker.
func WithFnmatchPatterns ¶ added in v0.7.0
func WithFnmatchPatterns(patterns ...string) WalkerOption
WithFnmatchPatterns filters results to match the patterns.
Default is not to do any filtering.
func WithMaxRecurseDepth ¶
func WithMaxRecurseDepth(maxDepth int) WalkerOption
WithMaxRecurseDepth controls maximum recursion depth while walking file tree.
Value of -1 disables depth control.
func WithSkipRoot ¶
func WithSkipRoot() WalkerOption
WithSkipRoot skips root path if it's a directory.