Documentation ¶
Overview ¶
Package extract provides archive extraction helpers.
Index ¶
Constants ¶
const ( // ExtractToTempDir is a sentinel destination value that will cause // [Extract] to generate a temporary directory for extraction, and remove // the temporary directory once extraction (and callbacks) have completed. // ExtractToTempDir is only useful if a [Callback] is passed to Extract. ExtractToTempDir = "" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Callback ¶
A Callback is a function called by Extract once an archive has been extracted. When called, the current working directory is the extract destination, and is also passed as the path parameter.
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
An Option configures the behavior of Extract.
func Delete ¶
Delete returns a new Option that configures Extract to delete any archive directories from the destination before extracting them.
func ExcludePaths ¶
ExcludePaths returns a new Option that configures Extract to exclude any matching paths from extraction. The given paths should be relative to either the archive root or the stripped prefix, and may be globs.
func IncludePaths ¶
IncludePaths returns a new Option that configures Extract to only consider the given paths for extraction. The given map's keys should be relative to either the archive root or the stripped prefix, and may be globs; the map's values are optional and specify non-default destinations for any path(s) matched by the corresponding key.