Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupported is returned when an unrecognized archive format is // encountered. ErrNotSupported = errors.New("not supported") // ErrDecompressorNotFound is returned when a requested decompressor has not // been registered. ErrDecompressorNotFound = errors.New("decompressor not found") )
Functions ¶
func NewLimitReader ¶
func NewLimitReader(r io.Reader, n int64) *io.LimitedReader
NewLimitReader warpper io limited
func RegisterDecompressor ¶
func RegisterDecompressor(method uint32, dcomp Decompressor)
RegisterDecompressor registers a decompressor.
Types ¶
type Decompressor ¶
type Decompressor func(r []io.Reader, options []byte, unpackSize uint64, ro *ReaderOptions) (io.Reader, error)
Decompressor is a handler function called when a registered decompressor is initialized.
type ReadCloser ¶
type ReadCloser struct { Reader // contains filtered or unexported fields }
ReadCloser provides an io.ReadCloser for the archive when opened with OpenReader.
func OpenReader ¶
func OpenReader(name string) (*ReadCloser, error)
OpenReader will open the 7z file specified by name and return a ReadCloser.
func (*ReadCloser) Close ¶
func (rc *ReadCloser) Close() error
Close closes the 7z file, rendering it unusable for I/O.
type Reader ¶
type Reader struct { Options ReaderOptions // contains filtered or unexported fields }
Reader is a 7z archive reader.
func NewReader ¶
NewReader returns a new Reader reading from r, which is assumed to have the given size in bytes.
type ReaderOptions ¶
type ReaderOptions struct {
// contains filtered or unexported fields
}
ReaderOptions are optional options to configure a 7z archive reader.
func (*ReaderOptions) Password ¶
func (o *ReaderOptions) Password() string
Password returns the set password. This will call the password callback supplied to SetPasswordCallback() if no password is set.
func (*ReaderOptions) SetPassword ¶
func (o *ReaderOptions) SetPassword(password string)
SetPassword sets the password used for extraction.
func (*ReaderOptions) SetPasswordCallback ¶
func (o *ReaderOptions) SetPasswordCallback(cb func() string)
SetPasswordCallback sets the callback thats used if a password is required, but wasn't supplied with SetPassword()