Documentation
¶
Index ¶
- Variables
- func SecureJoinArchivePath(destRoot, entryName string) (string, error)
- func TarGzDir(fsDir, prefixPath string) ([]byte, error)
- func TarGzDirFiles(fsDir, prefixPath string, skipNames map[string]struct{}) ([]byte, error)
- func TarGzDirFilesTo(w io.Writer, fsDir, prefixPath string, skipNames map[string]struct{}) (bool, error)
- func TarGzDirTo(w io.Writer, fsDir, prefixPath string) error
- func UntarGzDir(gzipStream io.Reader, dest string) error
- func UntarGzDirRootFilesOnly(gzipStream io.Reader, dest, requiredPrefix string) error
- func UntarGzDirUnderPrefix(gzipStream io.Reader, dest, requiredPrefix string) error
- type Error
- type ErrorKind
Constants ¶
This section is empty.
Variables ¶
var ( ErrValidation = &Error{Kind: KindValidation} ErrIntegrity = &Error{Kind: KindIntegrity} ErrTransport = &Error{Kind: KindTransport} )
Functions ¶
func SecureJoinArchivePath ¶
func TarGzDirFiles ¶
TarGzDirFiles creates a gzip-compressed tar of only the regular files and symlinks immediately inside fsDir (no subdirectory recursion). Files whose base names match skipNames are excluded. Returns nil if there are no files to include.
func TarGzDirFilesTo ¶
func TarGzDirFilesTo(w io.Writer, fsDir, prefixPath string, skipNames map[string]struct{}) (bool, error)
TarGzDirFilesTo writes a gzip-compressed tar of only the regular files immediately inside fsDir into w. Returns (hasFiles bool, err error). hasFiles is false if there are no files to write (nothing was written to w).
func TarGzDirTo ¶
TarGzDirTo writes a gzip-compressed tar of fsDir into w. prefixPath is used as the tar name prefix (same semantics as TarGzDir).
func UntarGzDirRootFilesOnly ¶
UntarGzDirRootFilesOnly extracts a gzip-compressed tar into dest. Only the directory entry for requiredPrefix itself, and regular files directly under requiredPrefix (no subdirectories), are allowed. Entries that go deeper return ErrIntegrity.
func UntarGzDirUnderPrefix ¶
UntarGzDirUnderPrefix extracts a gzip-compressed tar into dest. Every tar entry's path must begin with requiredPrefix+"/" or be exactly requiredPrefix. Entries outside that prefix return ErrIntegrity.