Documentation ¶
Index ¶
- Constants
- type Archive
- type ArchiveFactory
- type CompressionMethod
- type DefaultArchiveFactory
- func (e DefaultArchiveFactory) Open(filepath string, password string) (Archive, error)
- func (e DefaultArchiveFactory) OpenBytes(data []byte, password string) (Archive, error)
- func (e DefaultArchiveFactory) OpenReader(reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error)
- type Entry
- type ReaderAtCloser
Constants ¶
View Source
const GzipMaxLength = math.MaxUint32
View Source
const GzipWrapperLength = 18
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive interface { Entries() []Entry // List of all the archived file entries. Entry(path string) (Entry, error) // Gets the entry at the given `path`. Close() }
Represents an immutable archive.
func NewExplodedArchive ¶
type ArchiveFactory ¶
type ArchiveFactory interface { Open(filepath string, password string) (Archive, error) // Opens an archive from a local [file]. OpenBytes(data []byte, password string) (Archive, error) // Opens an archive from a [data] slice. OpenReader(reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error) // Opens an archive from a reader. }
type CompressionMethod ¶ added in v0.5.0
type CompressionMethod uint16
const ( CompressionMethodStore CompressionMethod = CompressionMethod(zip.Store) CompressionMethodDeflate CompressionMethod = CompressionMethod(zip.Deflate) )
type DefaultArchiveFactory ¶
type DefaultArchiveFactory struct {
// contains filtered or unexported fields
}
func NewArchiveFactory ¶
func NewArchiveFactory() DefaultArchiveFactory
func (DefaultArchiveFactory) Open ¶
func (e DefaultArchiveFactory) Open(filepath string, password string) (Archive, error)
Open implements ArchiveFactory
func (DefaultArchiveFactory) OpenBytes ¶
func (e DefaultArchiveFactory) OpenBytes(data []byte, password string) (Archive, error)
OpenBytes implements ArchiveFactory
func (DefaultArchiveFactory) OpenReader ¶
func (e DefaultArchiveFactory) OpenReader(reader ReaderAtCloser, size int64, password string, minimizeReads bool) (Archive, error)
OpenBytes implements ArchiveFactory
type Entry ¶
type Entry interface { Path() string // Absolute path to the entry in the archive. Length() uint64 // Uncompressed data length. CompressedLength() uint64 // Compressed data length. CompressedAs(compressionMethod CompressionMethod) bool // Whether the entry is compressed using the given method. Read(start int64, end int64) ([]byte, error) // Reads the whole content of this entry, or a portion when [start] or [end] are specified. Stream(w io.Writer, start int64, end int64) (int64, error) // Streams the whole content of this entry to a writer, or a portion when [start] or [end] are specified. StreamCompressed(w io.Writer) (int64, error) // Streams the compressed content of this entry to a writer. StreamCompressedGzip(w io.Writer) (int64, error) // Streams the compressed content of this entry to a writer in a GZIP container. ReadCompressed() ([]byte, error) // Reads the compressed content of this entry. ReadCompressedGzip() ([]byte, error) // Reads the compressed content of this entry inside a GZIP container. }
Holds an archive entry's metadata.
Click to show internal directories.
Click to hide internal directories.