matchers

package
Version: v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_DOC docType = iota
	TYPE_DOCX
	TYPE_XLS
	TYPE_XLSX
	TYPE_PPT
	TYPE_PPTX
	TYPE_OOXML
)

Variables

View Source
var (
	TypeEpub = newType("epub", "application/epub+zip")
	//TypeZip  = newType("zip", "application/zip")
	//TypeTar  = newType("tar", "application/x-tar")
	//TypeRar  = newType("rar", "application/x-rar-compressed")
	//TypeGz   = newType("gz", "application/gzip")
	//TypeBz2  = newType("bz2", "application/x-bzip2")
	//Type7z   = newType("7z", "application/x-7z-compressed")
	//TypeXz   = newType("xz", "application/x-xz")
	TypePdf = newType("pdf", "application/pdf")
	TypeRtf = newType("rtf", "application/rtf")
)
View Source
var (
	TypeMidi = newType("mid", "audio/midi")
	TypeMp3  = newType("mp3", "audio/mpeg")
	TypeM4a  = newType("m4a", "audio/m4a")
	TypeXM4a = newType("xm4a", "audio/x-m4a")
	TypeOgg  = newType("ogg", "audio/ogg")
	TypeFlac = newType("flac", "audio/x-flac")
	TypeWav  = newType("wav", "audio/x-wav")
	TypeAmr  = newType("amr", "audio/amr")
	TypeAac  = newType("aac", "audio/aac")
)
View Source
var (
	TypeDoc      = newType("doc", "application/msword")
	TypeDocx     = newType("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
	TypeXls      = newType("xls", "application/vnd.ms-excel")
	TypeXlsx     = newType("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
	TypePpt      = newType("ppt", "application/vnd.ms-powerpoint")
	TypePptx     = newType("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation")
	TypeOoxmlDoc = newType("docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
	TypeOoxmlXls = newType("xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
	TypeOoxmlPpt = newType("pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation")
)
View Source
var (
	TypeJpeg     = newType("jpg", "image/jpeg")
	TypeJpeg2000 = newType("jp2", "image/jp2")
	TypePng      = newType("png", "image/png")
	TypeGif      = newType("gif", "image/gif")
	TypeWebp     = newType("webp", "image/webp")
	TypeCR2      = newType("cr2", "image/x-canon-cr2")
	TypeTiff     = newType("tif", "image/tiff")
	TypeBmp      = newType("bmp", "image/bmp")
	TypeJxr      = newType("jxr", "image/vnd.ms-photo")
	TypePsd      = newType("psd", "image/vnd.adobe.photoshop")
	TypeIco      = newType("ico", "image/x-icon")
	TypeHeif     = newType("heif", "image/heif")
	TypeDwg      = newType("dwg", "image/vnd.dwg")
)
View Source
var (
	TypeMp4  = newType("mp4", "video/mp4")
	TypeM4v  = newType("m4v", "video/m4v")
	TypeXM4v = newType("xm4v", "video/x-m4v")
	TypeMkv  = newType("mkv", "video/x-matroska")
	TypeWebm = newType("webm", "video/webm")
	TypeMov  = newType("mov", "video/quicktime")
	TypeAvi  = newType("avi", "video/x-msvideo")
	TypeWmv  = newType("wmv", "video/x-ms-wmv")
	TypeMpeg = newType("mpg", "video/mpeg")
	TypeFlv  = newType("flv", "video/x-flv")
	Type3gp  = newType("3gp", "video/3gpp")
)
View Source
var Application = Map{}
View Source
var Archive = Map{
	TypeEpub: Epub,

	TypePdf: Pdf,
	TypeRtf: Rtf,
}
View Source
var Font = Map{}
View Source
var MatcherKeys []types.Type
View Source
var Matchers = make(map[types.Type]TypeMatcher)

Store registered file type matchers

Functions

func Aac added in v1.2.0

func Aac(buf []byte) bool

func Amr

func Amr(buf []byte) bool

func Avi

func Avi(buf []byte) bool

func Bmp

func Bmp(buf []byte) bool

func CR2

func CR2(buf []byte) bool

func Doc added in v1.0.4

func Doc(buf []byte) bool

func Docx added in v1.0.4

func Docx(buf []byte) bool

func Dwg added in v1.2.0

func Dwg(buf []byte) bool

func Epub

func Epub(buf []byte) bool

func Flac

func Flac(buf []byte) bool

func Flv

func Flv(buf []byte) bool

func Gif

func Gif(buf []byte) bool

func Heif added in v1.2.0

func Heif(buf []byte) bool

func Ico

func Ico(buf []byte) bool

func Jpeg

func Jpeg(buf []byte) bool

func Jpeg2000 added in v1.2.0

func Jpeg2000(buf []byte) bool

func Jxr

func Jxr(buf []byte) bool

func M4a

func M4a(buf []byte) bool

func M4v

func M4v(buf []byte) bool

func Match3gp added in v1.2.0

func Match3gp(buf []byte) bool

func Midi

func Midi(buf []byte) bool

func Mkv

func Mkv(buf []byte) bool

func Mov

func Mov(buf []byte) bool

func Mp3

func Mp3(buf []byte) bool

func Mp4

func Mp4(buf []byte) bool

func Mpeg

func Mpeg(buf []byte) bool

func Ogg

func Ogg(buf []byte) bool

func Ooxml added in v1.2.0

func Ooxml(buf []byte) bool

func Pdf

func Pdf(buf []byte) bool

func Png

func Png(buf []byte) bool

func Ppt added in v1.0.4

func Ppt(buf []byte) bool

func Pptx added in v1.0.4

func Pptx(buf []byte) bool

func Psd

func Psd(buf []byte) bool

func Rtf

func Rtf(buf []byte) bool

func Tiff

func Tiff(buf []byte) bool

func Wav

func Wav(buf []byte) bool

func Webm

func Webm(buf []byte) bool

func Webp

func Webp(buf []byte) bool

func Wmv

func Wmv(buf []byte) bool

func Xls added in v1.0.4

func Xls(buf []byte) bool

func Xlsx added in v1.0.4

func Xlsx(buf []byte) bool

Types

type Map

type Map map[types.Type]Matcher

Type interface to store pairs of type with its matcher function

type Matcher

type Matcher func([]byte) bool

Matcher function interface as type alias

type TypeMatcher

type TypeMatcher func([]byte) types.Type

Type specific matcher function interface

func NewMatcher

func NewMatcher(kind types.Type, fn Matcher) TypeMatcher

Create and register a new type matcher function

Directories

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