mimematcher

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

Add adds a set of MIME-type signatures to a MIMEMatcher

func Load

func Load(ls *persist.LoadSaver) core.Matcher

Load returns a MIMEMatcher

func Save

func Save(c core.Matcher, ls *persist.LoadSaver)

Save encodes a MIMEMatcher

Types

type Matcher

type Matcher map[string][]int

Matcher matches provided MIME-types against MIME-types associated with formats. This is an extra signal for identification akin to a file extension. It is used, for example, for web archive files (WARC) where you have declared MIME-types which you might want to verify.

func (Matcher) Identify

func (m Matcher) Identify(s string, na *siegreader.Buffer, hints ...core.Hint) (chan core.Result, error)

Identify tests the supplied MIME-type against the MIMEMatcher. The Buffer is not used.

func (Matcher) String

func (m Matcher) String() string

String representation of a MIMEMatcher

type Result

type Result struct {
	Trimmed bool
	// contains filtered or unexported fields
}

Result reports a MIME-type match. If Trimmed is true, then the supplied MIME-type was trimmed of text following a ";" before matching

func (Result) Basis

func (r Result) Basis() string

Basis for a MIME-type match is always just that the mime matched

func (Result) Index

func (r Result) Index() int

Index of the MIME-type match

type SignatureSet

type SignatureSet []string

SignatureSet for a MIMEMatcher is a slice of MIME-types

Jump to

Keyboard shortcuts

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