Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsIllegalPathError ¶
IsIllegalPathError returns true if the provided error is of the type IllegalPathError.
func NewModInfo ¶
func NewModInfo(name, version string) *modInfo
Types ¶
type File ¶
type File struct { os.FileInfo // The original header info; depends on // type of archive -- could be nil, too. Header interface{} // Allow the file contents to be read (and closed) io.ReadCloser }
File provides methods for accessing information about or contents of a file within an archive.
type IllegalPathError ¶
IllegalPathError is an error returned when an illegal path is detected during the archival process.
By default, only the Filename is showed on error, but you might also get the absolute value of the invalid path on the AbsolutePath field.
func (*IllegalPathError) Error ¶
func (err *IllegalPathError) Error() string
type ReadFakeCloser ¶
ReadFakeCloser is an io.Reader that has a no-op close method to satisfy the io.ReadCloser interface.
type Tar ¶
type Tar struct { // Whether to overwrite existing files; if false, // an error is returned if the file exists. OverwriteExisting bool // Whether to make all the directories necessary // to create a tar archive in the desired path. MkdirAll bool // A single top-level folder can be implicitly // created by the Archive or Unarchive methods // if the files to be added to the archive // or the files to be extracted from the archive // do not all have a common root. This roughly // mimics the behavior of archival tools integrated // into OS file browsers which create a subfolder // to avoid unexpectedly littering the destination // folder with potentially many files, causing a // problematic cleanup/organization situation. // This feature is available for both creation // and extraction of archives, but may be slightly // inefficient with lots and lots of files, // especially on extraction. ImplicitTopLevelFolder bool // Strip number of leading paths. This feature is available // only during unpacking of the entire archive. StripComponents int // If true, errors encountered during reading // or writing a single file will be logged and // the operation will continue on remaining files. ContinueOnError bool // contains filtered or unexported fields }
Tar provides facilities for operating TAR archives. See http://www.gnu.org/software/tar/manual/html_node/Standard.html.
func NewTar ¶
func NewTar() *Tar
NewTar returns a new, default instance ready to be customized and used.
func (*Tar) CheckPath ¶
CheckPath ensures that the filename has not been crafted to perform path traversal attacks