boar

package module
v0.0.0-...-e9c71f4 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 20 Imported by: 13

README

boar

build status codecov Go Report Card GoDoc MIT licensed

boar will sniff any archive, and maybe even let you extract it.

Under the hood, it uses:

License

boar's code itself is under MIT License, see LICENSE for details.

However:

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnrecognizedArchiveType = errors.New("Unrecognized archive type")
)

Functions

func CleanFileName

func CleanFileName(fileName string) string

func SimpleExtract

func SimpleExtract(params *SimpleExtractParams) (*savior.ExtractorResult, error)

Types

type Contents

type Contents struct {
	Entries []*Entry
}

type EntriesLister

type EntriesLister interface {
	Entries() []*savior.Entry
}

type Entry

type Entry struct {
	Name             string
	UncompressedSize int64
}

Entry refers to a file entry in an archive

type ExtractParams

type ExtractParams struct {
	File       eos.File
	StagePath  string
	OutputPath string

	Consumer *state.Consumer

	Load LoadFunc
	Save SaveFunc
}

type Info

type Info struct {
	Strategy    Strategy
	Features    savior.ExtractorFeatures
	Format      string
	PostExtract []string
}

func Probe

func Probe(params ProbeParams) (*Info, error)

Probe attempts to determine the type of an archive Returns (nil, nil) if it is not a recognized archive type Returns (nil, non-nil) if it IS a recognized archive type, but something's wrong with it. Returns (non-nil, nil) if it is a recognized archive type and we are confident we can extract it correctly.

func (*Info) GetExtractor

func (ai *Info) GetExtractor(file eos.File, consumer *state.Consumer) (savior.Extractor, error)

func (*Info) String

func (ai *Info) String() string

type LoadFunc

type LoadFunc func(state interface{}) error

type ProbeParams

type ProbeParams struct {
	File      eos.File
	Consumer  *state.Consumer
	Candidate *dash.Candidate
	OnEntries func(entries []*savior.Entry)
}

type SaveFunc

type SaveFunc func(state interface{}) error

type SimpleExtractParams

type SimpleExtractParams struct {
	ArchivePath       string
	DestinationFolder string
	Consumer          *state.Consumer
}

type Strategy

type Strategy int
const (
	StrategyNone Strategy = 0

	StrategyZip Strategy = 100
	// linux binaries for example - they might be MojoSetup installers
	// (.zip files), or they might not be.
	StrategyZipUnsure Strategy = 101

	StrategyTar    Strategy = 200
	StrategyTarGz  Strategy = 201
	StrategyTarBz2 Strategy = 202
	StrategyTarXz  Strategy = 203

	StrategySevenZip Strategy = 300
	// .exe files for example - might be self-extracting
	// archives 7-zip can handle, or they might not.
	StrategySevenZipUnsure Strategy = 301

	// .dmg files can only be properly extracted on macOS.
	// 7-zip struggles with ISO9660 disk images for example,
	// and doesn't support APFS yet (as of 18.05)
	StrategyDmg Strategy = 400

	// .rar files we do *not* want to open while probing
	StrategyRar Strategy = 500
)

func (Strategy) String

func (as Strategy) String() string

type ThrottledSaveFunc

type ThrottledSaveFunc func(state interface{}, force bool) bool

Saves the state if force is true or the interval has passed Returns true if the state was actually saved, false if not

func ThrottledSave

func ThrottledSave(params *ExtractParams) ThrottledSaveFunc

Directories

Path Synopsis
cmd
formulas
Code generated by go generate; DO NOT EDIT.
Code generated by go generate; DO NOT EDIT.

Jump to

Keyboard shortcuts

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