lzmadec

package module
v0.0.0-...-19ac3ee Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: MIT Imports: 11 Imported by: 27 modules, 24 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

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.

Documentation

Overview

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.

Index

Constants

This section is empty.

Variables

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")
)

Functions

This section is empty.

Types

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

Directories

Path Synopsis
cmd
test command

Jump to

Keyboard shortcuts

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