rardecode

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: BSD-2-Clause Imports: 21 Imported by: 290

README

rardecode

GoDoc

A go package for reading RAR archives.

Documentation

Index

Constants

View Source
const (
	HostOSUnknown = 0
	HostOSMSDOS   = 1
	HostOSOS2     = 2
	HostOSWindows = 3
	HostOSUnix    = 4
	HostOSMacOS   = 5
	HostOSBeOS    = 6
)

FileHeader HostOS types

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHeader

type FileHeader struct {
	Name             string    // file name using '/' as the directory separator
	IsDir            bool      // is a directory
	HostOS           byte      // Host OS the archive was created on
	Attributes       int64     // Host OS specific file attributes
	PackedSize       int64     // packed file size (or first block if the file spans volumes)
	UnPackedSize     int64     // unpacked file size
	UnKnownSize      bool      // unpacked file size is not known
	ModificationTime time.Time // modification time (non-zero if set)
	CreationTime     time.Time // creation time (non-zero if set)
	AccessTime       time.Time // access time (non-zero if set)
	Version          int       // file version
}

FileHeader represents a single file in a RAR archive.

func (*FileHeader) Mode

func (f *FileHeader) Mode() os.FileMode

Mode returns an os.FileMode for the file, calculated from the Attributes field.

type ReadCloser

type ReadCloser struct {
	Reader
	// contains filtered or unexported fields
}

func OpenReader

func OpenReader(name, password string) (*ReadCloser, error)

OpenReader opens a RAR archive specified by the name and returns a ReadCloser.

func (*ReadCloser) Close

func (rc *ReadCloser) Close() error

Close closes the rar file.

func (*ReadCloser) Volumes added in v1.1.0

func (rc *ReadCloser) Volumes() []string

Volumes returns the volume filenames that have been used in decoding the archive up to this point. This will include the current open volume if the archive is still being processed.

type Reader

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

Reader provides sequential access to files in a RAR archive.

func NewReader

func NewReader(r io.Reader, password string) (*Reader, error)

NewReader creates a Reader reading from r. NewReader only supports single volume archives. Multi-volume archives must use OpenReader.

func (*Reader) Next

func (r *Reader) Next() (*FileHeader, error)

Next advances to the next file in the archive.

func (*Reader) Read

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

Read reads from the current file in the RAR archive.

Jump to

Keyboard shortcuts

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