Documentation ¶
Index ¶
- Variables
- func AddDirToArchive(tw TarWriter, dir string) error
- func AddFileToArchive(tw TarWriter, path string, fi os.FileInfo) error
- func AddFilesToArchive(tw TarWriter, files []PathInfo) error
- func Extract(tr TarReader) error
- type HeaderOpt
- type NormalizingTarReader
- type NormalizingTarWriter
- type PathInfo
- type PathMode
- type TarReader
- type TarWriter
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AddDirToArchive ¶ added in v0.8.1
AddDirToArchive walks dir writes entries describing dir and all of its children files to the provided TarWriter
func AddFileToArchive ¶
AddFileToArchive writes an entry describing the file at path with the given os.FileInfo to the provided TarWriter
func AddFilesToArchive ¶ added in v0.9.0
AddFilesToArchive writes entries describing all files to the provided TarWriter
Types ¶
type NormalizingTarReader ¶ added in v0.9.0
type NormalizingTarReader struct { TarReader // contains filtered or unexported fields }
NormalizingTarReader read from the wrapped TarReader normalizes header before passing them through to the caller NormalizingTarReader always normalizes header.Name so that path separators match the runtime OS Other modifications can be enabled by invoking options on the NormalizingTarReader
func NewNormalizingTarReader ¶ added in v0.9.0
func NewNormalizingTarReader(tr TarReader) *NormalizingTarReader
NewNormalizingTarReader creates a NormalizingTarReaders that wraps the provided TarReader
func (*NormalizingTarReader) ExcludePaths ¶ added in v0.9.0
func (tr *NormalizingTarReader) ExcludePaths(paths []string)
ExcludedPaths configures an array of paths to be skipped on subsequent calls to Next Children of the configured paths will also be skipped paths should match the unmodified Name of the *tar.Header returned by the wrapped TarReader, not the normalized headers
func (*NormalizingTarReader) Next ¶ added in v0.9.0
func (tr *NormalizingTarReader) Next() (*tar.Header, error)
Next calls Next on the wrapped TarReader and applies modifications before returning the *tar.Header If the wrapped TarReader returns a *tar.Header matching an excluded path Next will proceed to the next entry,
returning the first non-excluded entry
Modification options will be apply in the order the options were invoked. Standard modifications (path separators normalization) are applied last.
func (*NormalizingTarReader) PrependDir ¶ added in v0.9.0
func (tr *NormalizingTarReader) PrependDir(dir string)
PrependDir will set the Name of any subsequently read *tar.Header the result of filepath.Join of dir and the
original Name
func (*NormalizingTarReader) Strip ¶ added in v0.9.0
func (tr *NormalizingTarReader) Strip(prefix string)
Strip removes leading directories for any subsequently read *tar.Header
type NormalizingTarWriter ¶ added in v0.9.0
type NormalizingTarWriter struct { TarWriter // contains filtered or unexported fields }
NormalizingTarWriter normalizes any written *tar.Header before passing it through to the wrapped TarWriter NormalizingTarWriter always normalizes ModTime, Uname, and Gname Other modifications can be enabled by invoking options on the NormalizingTarWriter
func NewNormalizingTarWriter ¶ added in v0.8.1
func NewNormalizingTarWriter(tw TarWriter) *NormalizingTarWriter
NewNormalizingTarWriter creates a NormalizingTarWriter that wraps the provided TarWriter
func (*NormalizingTarWriter) WithGID ¶ added in v0.9.0
func (tw *NormalizingTarWriter) WithGID(gid int)
WithGID sets Gid of any subsequently written *tar.Header to gid
func (*NormalizingTarWriter) WithModTime ¶ added in v0.9.0
func (tw *NormalizingTarWriter) WithModTime(modTime time.Time)
WithModTime sets the ModTime of any subsequently written *tar.Header to modTime
func (*NormalizingTarWriter) WithUID ¶ added in v0.9.0
func (tw *NormalizingTarWriter) WithUID(uid int)
WithUID sets Uid of any subsequently written *tar.Header to uid
func (*NormalizingTarWriter) WriteHeader ¶ added in v0.9.0
func (tw *NormalizingTarWriter) WriteHeader(hdr *tar.Header) error
WriteHeader writes the header to the wrapped TarWriter after applying standard and configured modifications Modification options will be apply in the order the options were invoked. Standard modification (ModTime, Uname, and Gname) are applied last.