Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Archives = []Archive{TarGz, Zip}
Archives is a collection of supported archive formats.
var TarGz = &ArchiveGzip{ ArchiveBase{ Exts: []string{".tgz", ".gz"}, Mimes: []string{"application/gzip", "application/x-gzip", "application/x-tar"}, }, }
TarGz represents an instance of a tar.gz archive file.
var Zip = &ArchiveZip{ ArchiveBase{ Exts: []string{".zip"}, Mimes: []string{"application/zip", "application/x-zip"}, }, }
Zip represents an instance of a zip archive file.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive interface { Extensions() []string Extract() error Filename() string MimeTypes() []string SetDestination(d string) SetFilename(n string) }
Archive represents the associated behaviour for a collection of files contained inside an archive format.
type ArchiveBase ¶
ArchiveBase represents a container for a collection of files.
func (ArchiveBase) Extensions ¶ added in v1.1.1
func (a ArchiveBase) Extensions() []string
Extension returns the accepted file extensions.
func (ArchiveBase) Extract ¶ added in v1.1.1
func (a ArchiveBase) Extract() error
Extract all files and folders from the collection.
func (ArchiveBase) Filename ¶
func (a ArchiveBase) Filename() string
Filename returns the file name.
func (ArchiveBase) MimeTypes ¶
func (a ArchiveBase) MimeTypes() []string
MimeTypes returns all valid mime types for the format.
func (*ArchiveBase) SetDestination ¶
func (a *ArchiveBase) SetDestination(d string)
SetDestination sets the destination for where files should be extracted.
func (*ArchiveBase) SetFilename ¶
func (a *ArchiveBase) SetFilename(n string)
SetFilename sets the name of the local archive file.
NOTE: This archive file is the 'container' of the archived files that will be extracted separately.
type ArchiveGzip ¶
type ArchiveGzip struct {
ArchiveBase
}
ArchiveGzip represents a container for the .tar.gz file format.
type ArchiveZip ¶
type ArchiveZip struct {
ArchiveBase
}
ArchiveZip represents a container for the .zip file format.