package module
Version: v0.0.0-...-c111bbf Latest Latest

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

Go to latest
Published: Aug 15, 2019 License: MIT Imports: 11 Imported by: 0


lzmadec is a Go package for extracting files out of .7z files using 7z program.

Short tutorial: http://blog.kowalczyk.info/article/g/Extracting-files-from-7z-archives-in-Go.html

API reference: http://godoc.org/github.com/kjk/lzmadec

Hopefully this is temporary hack and some day https://github.com/uli-go/xz will offer this functionality in pure Go code.



Package lzmadec implements extracting files from .7z archives. It requires 7z executable to be installed.

Short tutorial: http://blog.kowalczyk.info/article/g/Extracting-files-from-7z-archives-in-Go.html.



This section is empty.


View Source
var (
	// Err7zNotAvailable is returned if 7z executable is not available
	Err7zNotAvailable = errors.New("7z executable not available")

	// ErrNoEntries is returned if the archive has no files
	ErrNoEntries = errors.New("no entries in 7z file")


This section is empty.


type Archive

type Archive struct {
	Path    string
	Entries []Entry
	// contains filtered or unexported fields

Archive describes a single .7z archive

func NewArchive

func NewArchive(path string) (*Archive, error)

func NewEncryptedArchive

func NewEncryptedArchive(path string, password string) (*Archive, error)

func (*Archive) ExtractToFile

func (a *Archive) ExtractToFile(dstPath string, name string) error

ExtractToFile extracts a given file from the archive to a file on disk

func (*Archive) ExtractToWriter

func (a *Archive) ExtractToWriter(dst io.Writer, name string) error

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

type Entry

type Entry struct {
	Path       string
	Size       int64
	PackedSize int // -1 means "size unknown"
	Modified   time.Time
	Attributes string
	CRC        string
	Encrypted  string
	Method     string
	Block      int

Entry describes a single file inside .7z archive

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL