Documentation ¶
Overview ¶
Package unarchiver provides a method to unarchive tar.gz or zip archives with progress bar feedback Currently, this implementation copies a lot of methods that are internal to the ActiveState/archiver dependency.
Index ¶
- type ExtractNotifier
- type SingleUnarchiver
- type TarGzArchive
- type TarGzBlob
- type Unarchiver
- func (ua *Unarchiver) CheckExt(archiveName string) error
- func (ua *Unarchiver) Ext() string
- func (ua *Unarchiver) PrepareUnpacking(source, destination string) (archiveFile *os.File, fileSize int64, err error)
- func (ua *Unarchiver) SetNotifier(cb ExtractNotifier)
- func (ua *Unarchiver) Unarchive(archiveStream io.Reader, archiveSize int64, destination string) (err error)
- type ZipArchive
- type ZipBlob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtractNotifier ¶
ExtractNotifier gets called when a new file has been extracted from the archive
type SingleUnarchiver ¶
type SingleUnarchiver interface { archiver.Reader // ExtractNext extracts the next file in the archive ExtractNext(destination string) (f archiver.File, err error) // CheckExt checks that the file extension is appropriate for the archive CheckExt(archiveName string) error // Ext returns a valid file name extension for this archiver Ext() string }
SingleUnarchiver is an interface for an unarchiver that can unpack the next file It extends the existing archiver.Reader with a method to extract a single file from the archive
type TarGzArchive ¶
type TarGzArchive struct {
*archiver.TarGz
}
TarGzArchive is an extension of an TarGz archiver implementing an unarchive method with progress feedback
func (*TarGzArchive) Ext ¶
func (ar *TarGzArchive) Ext() string
func (*TarGzArchive) ExtractNext ¶
func (ar *TarGzArchive) ExtractNext(destination string) (f archiver.File, err error)
ExtractNext extracts the next file to destination
func (*TarGzArchive) GetExtractedSize ¶
func (ar *TarGzArchive) GetExtractedSize(source string) (int, error)
GetExtractedSize returns the size of the extracted summed up files in the archive
type TarGzBlob ¶
type TarGzBlob struct {
// contains filtered or unexported fields
}
func NewTarGzBlob ¶
type Unarchiver ¶
type Unarchiver struct {
// contains filtered or unexported fields
}
Unarchiver wraps an implementation of an unarchiver that can unpack one file at a time.
func (*Unarchiver) CheckExt ¶
func (ua *Unarchiver) CheckExt(archiveName string) error
CheckExt checks that the file extension is appropriate for the given unarchiver
func (*Unarchiver) Ext ¶
func (ua *Unarchiver) Ext() string
func (*Unarchiver) PrepareUnpacking ¶
func (ua *Unarchiver) PrepareUnpacking(source, destination string) (archiveFile *os.File, fileSize int64, err error)
PrepareUnpacking prepares the destination directory and the archive for unpacking Returns the opened file and its size
func (*Unarchiver) SetNotifier ¶
func (ua *Unarchiver) SetNotifier(cb ExtractNotifier)
SetNotifier sets the notification function to be called after extracting a file
type ZipArchive ¶
type ZipArchive struct {
*archiver.Zip
}
ZipArchive is an extension of an Zip archiver implementing an unarchive method with progress feedback
func (*ZipArchive) Ext ¶
func (z *ZipArchive) Ext() string
func (*ZipArchive) ExtractNext ¶
func (z *ZipArchive) ExtractNext(destination string) (f archiver.File, err error)
ExtractNext extracts the next file to destination