Documentation ¶
Overview ¶
Package xzip provides higher level types and functions on top of "arvhive/zip" package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archiver ¶
type Archiver struct {
// contains filtered or unexported fields
}
Archiver is a object to build a zip. You can read multiple source stream and forward as a zip stream to the destination like file, http form, ...etc. Builder is implemented on top of io.Pile so you do zip compression with less buffering on memory.
The basic usage is like:
a, _ := NewRawSourceFromFile("a.txt") defer a.Close() b, _ := NewRawSourceFromFile("b.txt") defer b.Close() builder := NewArchiver(a, b) zip, _ := os.Create("ab.zip") defer zip.Close() io.Copy(zip, buiilder)
func NewArchiver ¶
NewArchiver returns a new *Archiver from multiple raw sources.
type RawSource ¶
type RawSource struct { Name string Size uint64 ModifiedAt time.Time Mode os.FileMode // contains filtered or unexported fields }
RawSource is a source to create a Zip stream.
func NewRawSourceFromFile ¶
NewRawSourceFromFile returns a new *RawSource from file path
func NewRawSourceFromURL ¶
NewRawSourceFromURL returns a new *RawSource from URL
func (*RawSource) ZipHeader ¶
func (s *RawSource) ZipHeader() *zip.FileHeader
ZipHeader returns *zip.FileHeader to create a zip stream