Documentation ¶
Index ¶
- Constants
- Variables
- func AddMatcher(fileType types.Type, matcher matchers.Matcher) matchers.TypeMatcher
- func AddType(ext, mime string) types.Type
- func Application(buf []byte) (types.Type, error)
- func Archive(buf []byte) (types.Type, error)
- func Audio(buf []byte) (types.Type, error)
- func Document(buf []byte) (types.Type, error)
- func Font(buf []byte) (types.Type, error)
- func Get(buf []byte) (types.Type, error)
- func GetType(ext string) types.Type
- func Image(buf []byte) (types.Type, error)
- func Is(buf []byte, ext string) bool
- func IsApplication(buf []byte) bool
- func IsArchive(buf []byte) bool
- func IsAudio(buf []byte) bool
- func IsDocument(buf []byte) bool
- func IsExtension(buf []byte, ext string) bool
- func IsFont(buf []byte) bool
- func IsImage(buf []byte) bool
- func IsMIME(buf []byte, mime string) bool
- func IsMIMESupported(mime string) bool
- func IsSupported(ext string) bool
- func IsType(buf []byte, kind types.Type) bool
- func IsVideo(buf []byte) bool
- func Match(buf []byte) (types.Type, error)
- func MatchFile(filepath string) (types.Type, error)
- func MatchMap(buf []byte, matchers matchers.Map) types.Type
- func MatchReader(reader io.Reader) (types.Type, error)
- func Matches(buf []byte) bool
- func MatchesMap(buf []byte, matchers matchers.Map) bool
- func Video(buf []byte) (types.Type, error)
Constants ¶
const Version = "1.1.3"
Version exposes the current package version.
Variables ¶
var ErrEmptyBuffer = errors.New("Empty buffer")
ErrEmptyBuffer represents an empty buffer error
var ErrUnknownBuffer = errors.New("Unknown buffer type")
ErrUnknownBuffer represents a unknown buffer error
var MatcherKeys = &matchers.MatcherKeys
MatcherKeys is an alias to matchers.MatcherKeys
var Matchers = matchers.Matchers
Matchers is an alias to matchers.Matchers
var NewMatcher = matchers.NewMatcher
NewMatcher is an alias to matchers.NewMatcher
var NewType = types.NewType
NewType creates and registers a new type
var Types = types.Types
Types stores a map of supported types
var Unknown = types.Unknown
Unknown represents an unknown file type
Functions ¶
func AddMatcher ¶
AddMatcher registers a new matcher type
func Application ¶ added in v1.1.3
Application tries to match a file as an application type
func IsApplication ¶ added in v1.1.3
IsApplication checks if the given buffer is an application type
func IsDocument ¶ added in v1.0.6
IsDocument checks if the given buffer is an document type
func IsMIMESupported ¶
IsMIMESupported checks if a given MIME type is supported
func IsSupported ¶
IsSupported checks if a given file extension is supported
func MatchReader ¶
MatchReader is convenient wrapper to Match() any Reader
func MatchesMap ¶
MatchesMap is an alias to Matches() but using matching against a map of match functions
Types ¶
This section is empty.