tar

package
v1.7.9 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Restore

func Restore(r io.Reader, dir string) error

Restore reads a tar archive from r and extracts all of its files into dir, using only the base name of each file.

func SinceFilterTarFile

func SinceFilterTarFile(since time.Time) func(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error

Generates a filtering function for Stream that checks an incoming file, and only writes the file to the stream if its mod time is later than since. Example: to tar only files newer than a certain datetime, use tar.Stream(w, dir, relativePath, SinceFilterTarFile(datetime))

func Stream

func Stream(w io.Writer, dir, relativePath string, writeFunc func(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error) error

Stream is a convenience function for creating a tar of a shard dir. It walks over the directory and subdirs, possibly writing each file to a tar writer stream. By default StreamFile is used, which will result in all files being written. A custom writeFunc can be passed so that each file may be written, modified+written, or skipped depending on the custom logic.

func StreamFile

func StreamFile(f os.FileInfo, shardRelativePath, fullPath string, tw *tar.Writer) error

stream a single file to tw, extending the header name using the shardRelativePath

func StreamRenameFile added in v1.5.2

func StreamRenameFile(f os.FileInfo, tarHeaderFileName, relativePath, fullPath string, tw *tar.Writer) error

/ Stream a single file to tw, using tarHeaderFileName instead of the actual filename e.g., when we want to write a *.tmp file using the original file's non-tmp name.

Types

This section is empty.

Jump to

Keyboard shortcuts

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