Documentation ¶
Index ¶
- Constants
- Variables
- func Aac(buf []byte) bool
- func Aiff(buf []byte) bool
- func Amr(buf []byte) bool
- func Avi(buf []byte) bool
- func Bmp(buf []byte) bool
- func CR2(buf []byte) bool
- func Cab(buf []byte) bool
- func Dcm(buf []byte) bool
- func Dex(buf []byte) bool
- func Dey(buf []byte) bool
- func Doc(buf []byte) bool
- func Docx(buf []byte) bool
- func Dwg(buf []byte) bool
- func Elf(buf []byte) bool
- func Eot(buf []byte) bool
- func Flac(buf []byte) bool
- func Flv(buf []byte) bool
- func Gif(buf []byte) bool
- func Heif(buf []byte) bool
- func Ico(buf []byte) bool
- func Iso(buf []byte) bool
- func Jpeg(buf []byte) bool
- func Jpeg2000(buf []byte) bool
- func Jxr(buf []byte) bool
- func M4a(buf []byte) bool
- func M4v(buf []byte) bool
- func MachO(buf []byte) bool
- func Match3gp(buf []byte) bool
- func Midi(buf []byte) bool
- func Mkv(buf []byte) bool
- func Mov(buf []byte) bool
- func Mp3(buf []byte) bool
- func Mp4(buf []byte) bool
- func Mpeg(buf []byte) bool
- func Ogg(buf []byte) bool
- func Otf(buf []byte) bool
- func Png(buf []byte) bool
- func Ppt(buf []byte) bool
- func Pptx(buf []byte) bool
- func Psd(buf []byte) bool
- func Rar(buf []byte) bool
- func Rpm(buf []byte) bool
- func Swf(buf []byte) bool
- func Tar(buf []byte) bool
- func Tiff(buf []byte) bool
- func Ttf(buf []byte) bool
- func Wasm(buf []byte) bool
- func Wav(buf []byte) bool
- func Webm(buf []byte) bool
- func Webp(buf []byte) bool
- func Wmv(buf []byte) bool
- func Woff(buf []byte) bool
- func Woff2(buf []byte) bool
- func Xls(buf []byte) bool
- func Xlsx(buf []byte) bool
- func Z(buf []byte) bool
- func Zip(buf []byte) bool
- func Zst(buf []byte) bool
- type Map
- type Matcher
- type TypeMatcher
Constants ¶
View Source
const ( ZstdMagicSkippableStart = 0x184D2A50 ZstdMagicSkippableMask = 0xFFFFFFF0 )
View Source
const ( TYPE_DOC docType = iota TYPE_DOCX TYPE_XLS TYPE_XLSX TYPE_PPT TYPE_PPTX TYPE_OOXML )
Variables ¶
View Source
var ( TypeWasm = newType("wasm", "application/wasm") TypeDex = newType("dex", "application/vnd.android.dex") TypeDey = newType("dey", "application/vnd.android.dey") )
View Source
var ( TypeEpub = newType("epub", "application/epub+zip") TypeZip = newType("zip", "application/zip") TypeTar = newType("tar", "application/x-tar") TypeRar = newType("rar", "application/vnd.rar") TypeGz = newType("gz", "application/gzip") TypeBz2 = newType("bz2", "application/x-bzip2") Type7z = newType("7z", "application/x-7z-compressed") TypeXz = newType("xz", "application/x-xz") TypeZstd = newType("zst", "application/zstd") TypePdf = newType("pdf", "application/pdf") TypeExe = newType("exe", "application/vnd.microsoft.portable-executable") TypeSwf = newType("swf", "application/x-shockwave-flash") TypeRtf = newType("rtf", "application/rtf") TypeEot = newType("eot", "application/octet-stream") TypePs = newType("ps", "application/postscript") TypeSqlite = newType("sqlite", "application/vnd.sqlite3") TypeNes = newType("nes", "application/x-nintendo-nes-rom") TypeCrx = newType("crx", "application/x-google-chrome-extension") TypeCab = newType("cab", "application/vnd.ms-cab-compressed") TypeDeb = newType("deb", "application/vnd.debian.binary-package") TypeAr = newType("ar", "application/x-unix-archive") TypeZ = newType("Z", "application/x-compress") TypeLz = newType("lz", "application/x-lzip") TypeRpm = newType("rpm", "application/x-rpm") TypeElf = newType("elf", "application/x-executable") TypeDcm = newType("dcm", "application/dicom") TypeIso = newType("iso", "application/x-iso9660-image") TypeMachO = newType("macho", "application/x-mach-binary") // Mach-O binaries have no common extension. )
View Source
var ( TypeMidi = newType("mid", "audio/midi") TypeMp3 = newType("mp3", "audio/mpeg") TypeM4a = newType("m4a", "audio/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") TypeAiff = newType("aiff", "audio/x-aiff") )
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") )
View Source
var ( TypeWoff = newType("woff", "application/font-woff") TypeWoff2 = newType("woff2", "application/font-woff") TypeTtf = newType("ttf", "application/font-sfnt") TypeOtf = newType("otf", "application/font-sfnt") )
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/vnd.microsoft.icon") TypeHeif = newType("heif", "image/heif") TypeDwg = newType("dwg", "image/vnd.dwg") )
View Source
var ( TypeMp4 = newType("mp4", "video/mp4") TypeM4v = newType("m4v", "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 Archive = Map{ TypeEpub: bytePrefixMatcher(epubMagic), TypeZip: Zip, TypeTar: Tar, TypeRar: Rar, TypeGz: bytePrefixMatcher(gzMagic), TypeBz2: bytePrefixMatcher(bz2Magic), Type7z: bytePrefixMatcher(sevenzMagic), TypeXz: bytePrefixMatcher(xzMagic), TypeZstd: Zst, TypePdf: bytePrefixMatcher(pdfMagic), TypeExe: bytePrefixMatcher(exeMagic), TypeSwf: Swf, TypeRtf: bytePrefixMatcher(rtfMagic), TypeEot: Eot, TypePs: bytePrefixMatcher(psMagic), TypeSqlite: bytePrefixMatcher(sqliteMagic), TypeNes: bytePrefixMatcher(nesMagic), TypeCrx: bytePrefixMatcher(crxMagic), TypeCab: Cab, TypeDeb: bytePrefixMatcher(debMagic), TypeAr: bytePrefixMatcher(arMagic), TypeZ: Z, TypeLz: bytePrefixMatcher(lzMagic), TypeRpm: Rpm, TypeElf: Elf, TypeDcm: Dcm, TypeIso: Iso, TypeMachO: MachO, }
View Source
var Audio = Map{ TypeMidi: Midi, TypeMp3: Mp3, TypeM4a: M4a, TypeOgg: Ogg, TypeFlac: Flac, TypeWav: Wav, TypeAmr: Amr, TypeAac: Aac, TypeAiff: Aiff, }
View Source
var Document = Map{ TypeDoc: Doc, TypeDocx: Docx, TypeXls: Xls, TypeXlsx: Xlsx, TypePpt: Ppt, TypePptx: Pptx, }
View Source
var Image = Map{ TypeJpeg: Jpeg, TypeJpeg2000: Jpeg2000, TypePng: Png, TypeGif: Gif, TypeWebp: Webp, TypeCR2: CR2, TypeTiff: Tiff, TypeBmp: Bmp, TypeJxr: Jxr, TypePsd: Psd, TypeIco: Ico, TypeHeif: Heif, TypeDwg: Dwg, }
View Source
var MatcherKeys []types.Type
View Source
var Matchers = make(map[types.Type]TypeMatcher)
Store registered file type matchers
Functions ¶
func Zst ¶ added in v1.1.3
Zstandard compressed data is made of one or more frames. There are two frame formats defined by Zstandard: Zstandard frames and Skippable frames. See more details from https://tools.ietf.org/id/draft-kucherawy-dispatch-zstd-00.html#rfc.section.2
Types ¶
type TypeMatcher ¶
Type specific matcher function interface
func NewMatcher ¶
func NewMatcher(kind types.Type, fn Matcher) TypeMatcher
Create and register a new type matcher function
Source Files ¶
Click to show internal directories.
Click to hide internal directories.