Documentation
¶
Index ¶
- func CreateTarFromFs(fs vfs.FileSystem, path string, compress func(w io.Writer) io.WriteCloser, ...) (err error)
- func Epoch() time.Time
- func ExtractArchiveToFs(fs vfs.FileSystem, path string, fss ...vfs.FileSystem) error
- func ExtractArchiveToFsWithInfo(fs vfs.FileSystem, path string, fss ...vfs.FileSystem) (int64, int64, error)
- func ExtractTarToFs(fs vfs.FileSystem, in io.Reader) error
- func ExtractTarToFsWithInfo(fs vfs.FileSystem, in io.Reader) (fcnt int64, bcnt int64, err error)
- func ExtractTgzToTempFs(in io.Reader) (vfs.FileSystem, error)
- func Gzip(w io.Writer) io.WriteCloser
- func ListArchiveContent(path string, fss ...vfs.FileSystem) ([]string, error)
- func ListArchiveContentFromReader(r io.Reader) ([]string, error)
- func ListSortedFilesInDir(fs vfs.FileSystem, root string, flat bool) ([]string, error)
- func PackFsIntoTar(fs vfs.FileSystem, root string, writer io.Writer, opts TarFileSystemOptions) error
- func RegularFileInfoHeader(fi fs.FileInfo) *tar.Header
- func SimpleTarHeader(fs vfs.FileSystem, filepath string) (*tar.Header, error)
- func TarFlatFs(fs vfs.FileSystem, writer io.Writer) error
- func TgzFlatFs(fs vfs.FileSystem, writer io.Writer) error
- func TgzFs(fs vfs.FileSystem, writer io.Writer, options TarFileSystemOptions) (err error)
- func UnzipTarToFs(fs vfs.FileSystem, in io.Reader) error
- type TarFileSystemOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTarFromFs ¶
func CreateTarFromFs(fs vfs.FileSystem, path string, compress func(w io.Writer) io.WriteCloser, fss ...vfs.FileSystem) (err error)
func ExtractArchiveToFs ¶
func ExtractArchiveToFs(fs vfs.FileSystem, path string, fss ...vfs.FileSystem) error
ExtractArchiveToFs wunpacks an archive to a filesystem.
func ExtractArchiveToFsWithInfo ¶
func ExtractArchiveToFsWithInfo(fs vfs.FileSystem, path string, fss ...vfs.FileSystem) (int64, int64, error)
ExtractArchiveToFsWithInfo unpacks an archive to a filesystem.
func ExtractTarToFs ¶
func ExtractTarToFs(fs vfs.FileSystem, in io.Reader) error
ExtractTarToFs writes a tar stream to a filesystem.
func ExtractTarToFsWithInfo ¶
func ExtractTgzToTempFs ¶
func ExtractTgzToTempFs(in io.Reader) (vfs.FileSystem, error)
ExtractTgzToTempFs extracts a tar.gz archive to a temporary filesystem. You should call vfs.Cleanup on the returned filesystem to clean up the temporary files.
func ListArchiveContent ¶
func ListArchiveContent(path string, fss ...vfs.FileSystem) ([]string, error)
func ListSortedFilesInDir ¶
ListSortedFilesInDir returns a list of files in a directory sorted by name. Attention: If 'flat == true', files with same name but in different sub-paths, will be listed only once!!!
func PackFsIntoTar ¶
func PackFsIntoTar(fs vfs.FileSystem, root string, writer io.Writer, opts TarFileSystemOptions) error
PackFsIntoTar creates a tar archive from a filesystem.
func RegularFileInfoHeader ¶
RegularFileInfoHeader creates a tar header for a regular file (`tar.TypeReg`). Besides name and size, the other header fields are set to default values (`fs.ModePerm`, 0, "", `time.Unix(0,0)`).
func SimpleTarHeader ¶
func TgzFlatFs ¶ added in v0.25.0
func TgzFlatFs(fs vfs.FileSystem, writer io.Writer) error
TgzFlatFs creates a tar.gz archive from a filesystem with all files being in the root of the zipped archive. The writer is closed after the archive is written. The TAR-headers are normalized, see RegularFileInfoHeader.
func TgzFs ¶
func TgzFs(fs vfs.FileSystem, writer io.Writer, options TarFileSystemOptions) (err error)
TgzFs works like PackFsIntoTar, but compresses the tar archive with gzip.NewWriter.
func UnzipTarToFs ¶
func UnzipTarToFs(fs vfs.FileSystem, in io.Reader) error
UnzipTarToFs tries to decompress the input stream and then writes the tar stream to a filesystem.
Types ¶
type TarFileSystemOptions ¶
type TarFileSystemOptions struct {
IncludeFiles []string
ExcludeFiles []string
// PreserveDir defines that the directory specified in the Path field should be included in the blob.
// Only supported for Type dir.
PreserveDir bool
// ZeroModTime defines that the modtime of the files added to the tar should be zeroed. This is important
// if the TAR archives need to be comparable on byte level (e.g. for hashing). To get fully byte-equivalent
// TAR archives at different timestamps, the mod time needs to be set to 0.
ZeroModTime bool
FollowSymlinks bool
// contains filtered or unexported fields
}
TarFileSystemOptions describes additional options for tarring a filesystem.