libarchive

package
v0.0.0-...-746469e Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2020 License: Apache-2.0 Imports: 7 Imported by: 27

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	NewRead() Archive
	ReadSupportFilterAll(a Archive) error
	ReadSupportFormatRaw(a Archive) error
	ReadSupportFormatAll(a Archive) error
	ReadSupportFormatEmpty(a Archive) error
	ReadOpenFileName(a Archive, filename string, blockSize int) error
	ReadFree(a Archive)
	ReadNextHeader(a Archive, e *ArchiveEntry) error
	ReadData(a Archive, buffer []byte, length int) (int, error)
	ReadDataSkip(a Archive) error
	WriteDiskNew() Archive
	WriteDiskSetOptions(a Archive, flags int)
	WriteDiskSetStandardLookup(a Archive)
	WriteFree(a Archive)
	WriteHeader(a Archive, e ArchiveEntry) error
	WriteFinishEntry(a Archive) error
	EntrySize(e ArchiveEntry) int64
	EntrySizeIsSet(e ArchiveEntry) bool
	EntryPathname(e ArchiveEntry) string
	Unpack(tarballPath string, targetPath string, enableRaw bool) error
}

API is the libarchive API provided by this package

type Archive

type Archive struct {
	// contains filtered or unexported fields
}

Archive is a wrapper for "C.struct_archive"

type ArchiveEntry

type ArchiveEntry struct {
	// contains filtered or unexported fields
}

ArchiveEntry is a wrapper for "C.struct_archive_entry"

type LibArchive

type LibArchive struct {
}

LibArchive is the default implementation of API

func (LibArchive) EntryPathname

func (la LibArchive) EntryPathname(e ArchiveEntry) string

EntryPathname is a wrapper for ""

func (LibArchive) EntrySize

func (la LibArchive) EntrySize(e ArchiveEntry) int64

EntrySize is a wrapper for "C.archive_entry_size()"

func (LibArchive) EntrySizeIsSet

func (la LibArchive) EntrySizeIsSet(e ArchiveEntry) bool

EntrySizeIsSet is a wrapper for "C.archive_entry_size_is_set()"

func (LibArchive) NewRead

func (la LibArchive) NewRead() Archive

NewRead is a wrapper for "C.archive_read_new()"

func (LibArchive) ReadData

func (la LibArchive) ReadData(a Archive, buffer []byte, length int) (int, error)

ReadData is a wrapper for "C.archive_read_data()"

func (LibArchive) ReadDataSkip

func (la LibArchive) ReadDataSkip(a Archive) error

ReadDataSkip is a wrapper for "C.archive_read_data_skip()"

func (LibArchive) ReadFree

func (la LibArchive) ReadFree(a Archive)

ReadFree is a wrapper for "C.archive_read_free()"

func (LibArchive) ReadNextHeader

func (la LibArchive) ReadNextHeader(a Archive, e *ArchiveEntry) error

ReadNextHeader is a wrapper for "C.archive_read_next_header()"

func (LibArchive) ReadOpenFileName

func (la LibArchive) ReadOpenFileName(a Archive, filename string, blockSize int) error

ReadOpenFileName is a wrapper for "C.archive_read_open_filename()"

func (LibArchive) ReadSupportFilterAll

func (la LibArchive) ReadSupportFilterAll(a Archive) error

ReadSupportFilterAll is a wrapper for "C.archive_read_support_filter_all()"

func (LibArchive) ReadSupportFormatAll

func (la LibArchive) ReadSupportFormatAll(a Archive) error

ReadSupportFormatAll is a wrapper for "C.archive_read_support_format_all()"

func (LibArchive) ReadSupportFormatEmpty

func (la LibArchive) ReadSupportFormatEmpty(a Archive) error

ReadSupportFormatEmpty is a wrapper for "C.archive_read_support_format_empty()"

func (LibArchive) ReadSupportFormatRaw

func (la LibArchive) ReadSupportFormatRaw(a Archive) error

ReadSupportFormatRaw is a wrapper for "C.archive_read_support_format_raw()"

func (LibArchive) Unpack

func (la LibArchive) Unpack(tarballPath string, targetPath string, enableRaw bool) error

Unpack contains the algorithm to extract files from a tarball and put them on a directory

func (LibArchive) WriteDiskNew

func (la LibArchive) WriteDiskNew() Archive

WriteDiskNew is a wrapper for "C.archive_write_disk_new()"

func (LibArchive) WriteDiskSetOptions

func (la LibArchive) WriteDiskSetOptions(a Archive, flags int)

WriteDiskSetOptions is a wrapper for "C.archive_write_disk_set_options()"

func (LibArchive) WriteDiskSetStandardLookup

func (la LibArchive) WriteDiskSetStandardLookup(a Archive)

WriteDiskSetStandardLookup is a wrapper for "C.archive_write_disk_set_standard_lookup()"

func (LibArchive) WriteFinishEntry

func (la LibArchive) WriteFinishEntry(a Archive) error

WriteFinishEntry is a wrapper for "C.archive_write_finish_entry()"

func (LibArchive) WriteFree

func (la LibArchive) WriteFree(a Archive)

WriteFree is a wrapper for "C.archive_write_free()"

func (LibArchive) WriteHeader

func (la LibArchive) WriteHeader(a Archive, e ArchiveEntry) error

WriteHeader is a wrapper for "C.archive_write_header()"

type Reader

type Reader struct {
	API                 // the implementation being used
	Archive     Archive // the Archive being used
	ChunkSize   int     // the chunk size being used
	ArchivePath string  // the path of the Archive being used
}

Reader is an abstraction that implements the io.Reader interface

func NewReader

func NewReader(api API, filePath string, chunkSize int) (*Reader, error)

NewReader is a factory method used to create a new Reader. Must receive an API implementation, the filePath on which the file will be read and the chunkSize used for reading

func (Reader) ExtractFile

func (r Reader) ExtractFile(filename string, target io.Writer) error

ExtractFile extracts a single file from the associated Archive to the 'target' interface

func (Reader) Free

func (r Reader) Free()

Free frees the Archive

func (Reader) Read

func (r Reader) Read(p []byte) (n int, err error)

Read implements the io.Reader interface

func (Reader) ReadNextHeader

func (r Reader) ReadNextHeader() error

ReadNextHeader setups the Archive for a set of reads

Jump to

Keyboard shortcuts

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