sz

package
v0.0.0-...-e327cec Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodeNoError ErrorCode = C.LIB7ZIP_NO_ERROR

	ErrCodeUnknownError ErrorCode = C.LIB7ZIP_UNKNOWN_ERROR
	ErrUnknownError               = errors.New("Unknown 7-zip error")

	ErrCodeNotInitialize ErrorCode = C.LIB7ZIP_NOT_INITIALIZE
	ErrNotInitialize               = errors.New("7-zip not initialized")

	ErrCodeNeedPassword ErrorCode = C.LIB7ZIP_NEED_PASSWORD
	ErrNeedPassword               = errors.New("Password required to extract archive with 7-zip")

	ErrCodeNotSupportedArchive ErrorCode = C.LIB7ZIP_NOT_SUPPORTED_ARCHIVE
	ErrNotSupportedArchive               = errors.New("Archive type not supported by 7-zip")
)

Functions

This section is empty.

Types

type Archive

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

func (*Archive) Close

func (a *Archive) Close()

func (*Archive) Extract

func (a *Archive) Extract(i *Item, out *OutStream) error

func (*Archive) ExtractSeveral

func (a *Archive) ExtractSeveral(indices []int64, ec *ExtractCallback) error

func (*Archive) Free

func (a *Archive) Free()

func (*Archive) GetArchiveFormat

func (a *Archive) GetArchiveFormat() string

func (*Archive) GetItem

func (a *Archive) GetItem(index int64) *Item

func (*Archive) GetItemCount

func (a *Archive) GetItemCount() (int64, error)

type ErrorCode

type ErrorCode int32

type ExtractCallback

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

func NewExtractCallback

func NewExtractCallback(funcs ExtractCallbackFuncs) (*ExtractCallback, error)

func (*ExtractCallback) Errors

func (ec *ExtractCallback) Errors() []error

func (*ExtractCallback) Free

func (ec *ExtractCallback) Free()

type ExtractCallbackFuncs

type ExtractCallbackFuncs interface {
	SetProgress(completed int64, total int64)
	GetStream(item *Item) (*OutStream, error)
}

type InStream

type InStream struct {
	Stats *ReadStats

	ChunkSize int64
	// contains filtered or unexported fields
}

func NewInStream

func NewInStream(reader ReaderAtCloser, ext string, size int64) (*InStream, error)

func (*InStream) Error

func (in *InStream) Error() error

func (*InStream) Free

func (in *InStream) Free()

func (*InStream) Seek

func (in *InStream) Seek(offset int64, whence int) (int64, error)

func (*InStream) SetExt

func (in *InStream) SetExt(ext string)

type Item

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

func (*Item) Free

func (i *Item) Free()

func (*Item) GetArchiveIndex

func (i *Item) GetArchiveIndex() int64

func (*Item) GetBoolProperty

func (i *Item) GetBoolProperty(id PropertyIndex) (bool, bool)

func (*Item) GetStringProperty

func (i *Item) GetStringProperty(id PropertyIndex) (string, bool)

func (*Item) GetUInt64Property

func (i *Item) GetUInt64Property(id PropertyIndex) (uint64, bool)

type Lib

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

func NewLib

func NewLib() (*Lib, error)

func (*Lib) Error

func (l *Lib) Error() error

func (*Lib) Free

func (l *Lib) Free()

func (*Lib) GetVersion

func (l *Lib) GetVersion() string

func (*Lib) OpenArchive

func (lib *Lib) OpenArchive(in *InStream, bySignature bool) (*Archive, error)

type OutStream

type OutStream struct {
	ChunkSize int64
	// contains filtered or unexported fields
}

func NewOutStream

func NewOutStream(writer io.WriteCloser) (*OutStream, error)

func (*OutStream) Close

func (out *OutStream) Close() error

func (*OutStream) Error

func (out *OutStream) Error() error

func (*OutStream) Free

func (out *OutStream) Free()

type PropertyIndex

type PropertyIndex int32
var (
	// Packed Size
	PidPackSize PropertyIndex = C.kpidPackSize
	// Attributes
	PidAttrib PropertyIndex = C.kpidAttrib
	// Created
	PidCTime PropertyIndex = C.kpidCTime
	// Accessed
	PidATime PropertyIndex = C.kpidATime
	// Modified
	PidMTime PropertyIndex = C.kpidMTime
	// Solid
	PidSolid PropertyIndex = C.kpidSolid
	// Encrypted
	PidEncrypted PropertyIndex = C.kpidEncrypted
	// User
	PidUser PropertyIndex = C.kpidUser
	// Group
	PidGroup PropertyIndex = C.kpidGroup
	// Comment
	PidComment PropertyIndex = C.kpidComment
	// Physical Size
	PidPhySize PropertyIndex = C.kpidPhySize
	// Headers Size
	PidHeadersSize PropertyIndex = C.kpidHeadersSize
	// Checksum
	PidChecksum PropertyIndex = C.kpidChecksum
	// Characteristics
	PidCharacts PropertyIndex = C.kpidCharacts
	// Creator Application
	PidCreatorApp PropertyIndex = C.kpidCreatorApp
	// Total Size
	PidTotalSize PropertyIndex = C.kpidTotalSize
	// Free Space
	PidFreeSpace PropertyIndex = C.kpidFreeSpace
	// Cluster Size
	PidClusterSize PropertyIndex = C.kpidClusterSize
	// Label
	PidVolumeName PropertyIndex = C.kpidVolumeName
	// FullPath
	PidPath PropertyIndex = C.kpidPath
	// IsDir
	PidIsDir PropertyIndex = C.kpidIsDir
	// Uncompressed Size
	PidSize PropertyIndex = C.kpidSize
	// Symbolic link destination
	PidSymLink PropertyIndex = C.kpidSymLink
	// POSIX attributes
	PidPosixAttrib PropertyIndex = C.kpidPosixAttrib
)

type ReadOp

type ReadOp struct {
	Offset int64
	Size   int64
}

type ReadStats

type ReadStats struct {
	Reads []ReadOp
}

func (*ReadStats) RecordRead

func (rs *ReadStats) RecordRead(offset int64, size int64)

type ReaderAtCloser

type ReaderAtCloser interface {
	io.ReaderAt
	io.Closer
}

Jump to

Keyboard shortcuts

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