archive

package
v0.0.0-...-70e1626 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

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

func NewExplodedArchive(directory string) Archive

func NewGoZIPArchive

func NewGoZIPArchive(zip *zip.Reader, closer func() error, minimizeReads bool) Archive

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 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.
	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.

}

Holds an archive entry's metadata.

type ReaderAtCloser

type ReaderAtCloser interface {
	io.Closer
	io.ReaderAt
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL