Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultExclusionPattern = regexp.MustCompile(`(^|/)\.git(/|$)`)
DefaultExclusionPattern is the pattern of files that will not be included in a tar file when creating one. By default it is any file inside a .git metadata directory
Functions ¶
This section is empty.
Types ¶
type ChmodAdapter ¶ added in v1.1.4
ChmodAdapter changes the mode of files and directories inline as a tarfile is being written
func (ChmodAdapter) WriteHeader ¶ added in v1.1.4
func (a ChmodAdapter) WriteHeader(hdr *tar.Header) error
WriteHeader changes the mode of files and directories inline as a tarfile is being written
type RenameAdapter ¶ added in v1.1.4
RenameAdapter renames files and directories inline as a tarfile is being written
func (RenameAdapter) WriteHeader ¶ added in v1.1.4
func (a RenameAdapter) WriteHeader(hdr *tar.Header) error
WriteHeader renames files and directories inline as a tarfile is being written
type Tar ¶
type Tar interface { // SetExclusionPattern sets the exclusion pattern for tar // creation SetExclusionPattern(*regexp.Regexp) // CreateTarFile creates a tar file in the base directory // using the contents of dir directory // The name of the new tar file is returned if successful CreateTarFile(base, dir string) (string, error) // CreateTarStreamToTarWriter creates a tar from the given directory // and streams it to the given writer. // An error is returned if an error occurs during streaming. // Archived file names are written to the logger if provided CreateTarStreamToTarWriter(dir string, includeDirInPath bool, writer Writer, logger io.Writer) error // CreateTarStream creates a tar from the given directory // and streams it to the given writer. // An error is returned if an error occurs during streaming. CreateTarStream(dir string, includeDirInPath bool, writer io.Writer) error // CreateTarStreamReader returns an io.ReadCloser from which a tar stream can be // read. The tar stream is created using CreateTarStream. CreateTarStreamReader(dir string, includeDirInPath bool) io.ReadCloser // ExtractTarStream extracts files from a given tar stream. // Times out if reading from the stream for any given file // exceeds the value of timeout. ExtractTarStream(dir string, reader io.Reader) error // ExtractTarStreamWithLogging extracts files from a given tar stream. // Times out if reading from the stream for any given file // exceeds the value of timeout. // Extracted file names are written to the logger if provided. ExtractTarStreamWithLogging(dir string, reader io.Reader, logger io.Writer) error // ExtractTarStreamFromTarReader extracts files from a given tar stream. // Times out if reading from the stream for any given file // exceeds the value of timeout. // Extracted file names are written to the logger if provided. ExtractTarStreamFromTarReader(dir string, tarReader Reader, logger io.Writer) error }
Tar can create and extract tar files used in an STI build
func NewParanoid ¶ added in v1.1.10
func NewParanoid(fs fs.FileSystem) Tar
NewParanoid creates a new Tar that has restrictions on what it can do while extracting files.
func NewParanoidWithTimeout ¶ added in v1.1.14
func NewParanoidWithTimeout(fs fs.FileSystem, timeout time.Duration) Tar
NewParanoidWithTimeout creates a new Tar with the provided timeout extracting files. It has restrictions on what it can do while extracting files.
func NewWithTimeout ¶ added in v1.1.14
func NewWithTimeout(fs fs.FileSystem, timeout time.Duration) Tar
NewWithTimeout creates a new Tar with the provided timeout extracting files.