archiver

package
v0.3.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2020 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package archiver provides a service to archive part of the filesystem into tar archive

Index

Constants

View Source
const OSPathSeparator = string(os.PathSeparator)

OSPathSeparator is the string version of the os.PathSeparator

Variables

This section is empty.

Functions

func Tar

func Tar(ctx context.Context, paths <-chan FileItem, output io.Writer) error

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) error

TarGz produces .tar.gz archive of filesystem starting at rootPath

func Walker

func Walker(ctx context.Context, rootPath string, options ...WalkerOption) (<-chan FileItem, error)

Walker provides a channel of file info/paths for archival

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 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.

Jump to

Keyboard shortcuts

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