Documentation ¶
Index ¶
- Constants
- Variables
- func NewFileSystem() *fs
- func NewTarTimeoutError() error
- type ChmodAdapter
- type Error
- type RenameAdapter
- type TapArchiver
- func (h TapArchiver) Chmod(file string, mode os.FileMode) error
- func (t *TapArchiver) CreateTarFile(base, dir string) (string, error)
- func (t *TapArchiver) CreateTarStream(dir string, includeDirInPath bool, writer io.Writer) error
- func (t *TapArchiver) CreateTarStreamReader(dir string, includeDirInPath bool) io.ReadCloser
- func (t *TapArchiver) CreateTarStreamToTarWriter(dir string, includeDirInPath bool, tarWriter *tar.Writer, logger io.Writer) error
- func (t *TapArchiver) ExtractTarStream(dir string, reader io.Reader) error
- func (t *TapArchiver) ExtractTarStreamFromTarReader(dir string, tarReader *tar.Reader, logger io.Writer) error
- func (t *TapArchiver) ExtractTarStreamWithLogging(dir string, reader io.Reader, logger io.Writer) error
- func (t *TapArchiver) SetExclusionPattern(p *regexp.Regexp)
Constants ¶
const ( WorkdirError int = 1 + iota TarTimeoutError DownloadError URLHandlerError SourcePathError UserNotAllowedError EmptyGitRepositoryError )
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 ¶
func NewFileSystem ¶
func NewFileSystem() *fs
NewFileSystem creates a new instance of the default FileSystem implementation
func NewTarTimeoutError ¶
func NewTarTimeoutError() error
NewTarTimeoutError returns a new error which indicates there was a problem when sending or receiving tar stream
Types ¶
type ChmodAdapter ¶
ChmodAdapter changes the mode of files and directories inline as a tarfile is being written
func (ChmodAdapter) WriteHeader ¶
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 ¶
RenameAdapter renames files and directories inline as a tarfile is being written
func (RenameAdapter) WriteHeader ¶
func (a RenameAdapter) WriteHeader(hdr *tar.Header) error
WriteHeader renames files and directories inline as a tarfile is being written
type TapArchiver ¶
type TapArchiver struct {
// contains filtered or unexported fields
}
stiTar is an implementation of the Tar interface
func NewParanoid ¶
func NewParanoid() *TapArchiver
NewParanoid creates a new Tar that has restrictions on what it can do while extracting files.
func (*TapArchiver) CreateTarFile ¶
func (t *TapArchiver) CreateTarFile(base, dir string) (string, error)
CreateTarFile creates a tar file from the given directory while excluding files that match the given exclusion pattern It returns the name of the created file
func (*TapArchiver) CreateTarStream ¶
CreateTarStream calls CreateTarStreamToTarWriter with a nil logger
func (*TapArchiver) CreateTarStreamReader ¶
func (t *TapArchiver) CreateTarStreamReader(dir string, includeDirInPath bool) io.ReadCloser
CreateTarStreamReader returns an io.ReadCloser from which a tar stream can be read. The tar stream is created using CreateTarStream.
func (*TapArchiver) CreateTarStreamToTarWriter ¶
func (t *TapArchiver) CreateTarStreamToTarWriter(dir string, includeDirInPath bool, tarWriter *tar.Writer, logger io.Writer) error
CreateTarStreamToTarWriter creates a tar stream on the given writer from the given directory while excluding files that match the given exclusion pattern.
func (*TapArchiver) ExtractTarStream ¶
func (t *TapArchiver) ExtractTarStream(dir string, reader io.Reader) error
ExtractTarStream calls ExtractTarStreamFromTarReader with a default reader and nil logger
func (*TapArchiver) ExtractTarStreamFromTarReader ¶
func (t *TapArchiver) ExtractTarStreamFromTarReader(dir string, tarReader *tar.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
func (*TapArchiver) ExtractTarStreamWithLogging ¶
func (t *TapArchiver) ExtractTarStreamWithLogging(dir string, reader io.Reader, logger io.Writer) error
ExtractTarStreamWithLogging calls ExtractTarStreamFromTarReader with a default reader
func (*TapArchiver) SetExclusionPattern ¶
func (t *TapArchiver) SetExclusionPattern(p *regexp.Regexp)
SetExclusionPattern sets the exclusion pattern for tar creation. The exclusion pattern always uses UNIX-style (/) path separators, even on Windows.