Documentation ¶
Overview ¶
Package unrarwrapper implements extracting files from .rar archives. It requires [unrar](https://www.rarlab.com/rar_add.htm) executable to be installed.
the code is based on github.com/kjk/lzmadec
ref: http://blog.kowalczyk.info/article/g/Extracting-files-from-7z-archives-in-Go.html.
Index ¶
Constants ¶
View Source
const NormalSep = "\n"
Variables ¶
View Source
var ( // ErrUnRARNotAvailable is returned if unrar executable is not available ErrUnRARNotAvailable = errors.New("unrar executable not available") // ErrNoEntries is returned if the archive has no files ErrNoEntries = errors.New("no entries in rar file") )
Functions ¶
func SetUnRARPath ¶
func SetUnRARPath(path string)
Types ¶
type Archive ¶
type Archive struct { Path string Entries []Entry IsMultiVolume bool Volumes []string // contains filtered or unexported fields }
Archive describes a single .rar archive
func NewArchive ¶
func (*Archive) ExtractToFile ¶
ExtractToFile extracts a given file from the archive to a file on disk
func (*Archive) ExtractToWriter ¶
ExtractToWriter writes the content of a given file inside the archive to dst
func (*Archive) GetFileReader ¶
func (a *Archive) GetFileReader(name string) (io.ReadCloser, error)
GetFileReader returns a reader for reading a given file
func (*Archive) GetVolumes ¶ added in v1.2.0
type Entry ¶
type Entry struct { Name string Size int64 // extracted size in bytes PackedSize int64 // -1 means "size unknown" Ratio string // Ratio: 54% Modified time.Time Attributes string // Attributes: -rw-r--r-- CRC string HostOS string // zip, rar Compression string Flags string // Flags: encrypted (directory does not have this field) Type EntryType // Type: Directory or File RarFilename *string // the rar filename of the entry belongs to, a single entry may in two volumes }
Entry describes a single file inside .rar,.zip archive
Click to show internal directories.
Click to hide internal directories.