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 FileType
- type WalkerOption
Constants ¶
View Source
const OSPathSeparator = string(os.PathSeparator)
OSPathSeparator is the string version of the os.PathSeparator.
Variables ¶
This section is empty.
Functions ¶
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.
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 WithFileTypes ¶ added in v0.9.0
func WithFileTypes(fileType ...FileType) WalkerOption
WithFileTypes filters results by file types.
Default is not to do any filtering.
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.
Click to show internal directories.
Click to hide internal directories.