Documentation ¶
Overview ¶
Package targo provides functions to create or extract tar archives.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create creates a tar archive from the directory specified by dirPath. The resulting tar archive format is in POSIX.1 format. Calling this function with dirPath having a trailing slash results in the content of dirPath to be used at the root level of the archive rather than the directory pointed out by dirPath itself.
Example ¶
A path without an ending slash will produce a tar archive with the directory specified by dirPath at its root.
Create(bardirPath+".tar", bardirPath) // Will result in a tar archive with bardir at its root level
Output:
Example (Slash) ¶
A path with an ending slash will produce a tar archive with the content of the directory specified by dirPath at its root.
Create(bardirPath+".tar", bardirPath+"/") // Will result in a tar archive with the files and folders inside bardir at // its root level
Output:
func CreateInPlace ¶
CreateInPlace behaves just as Create but it creates the archive in place. This means that the original directory specified by dirPath is removed after the tar archive is created. The .tar suffix is automatically added to dirPath and is used as the name of the newly created archive.
func ExtractInPlace ¶
ExtractInPlace extracts a tar archive, in place, given its path. The original tar archive is removed after extraction and only its content remains. Note that archivePath is expected to contain a file extension.
Types ¶
This section is empty.