package matchers

import "github.com/gabriel-vasile/mimetype/internal/matchers"

Package matchers holds the matching functions used to find MIME types.

Index

Functions

func AMp4

func AMp4(in []byte, _ uint32) bool

AMp4 matches an audio MP4 file.

func Aac

func Aac(in []byte, _ uint32) bool

Aac matches an Advanced Audio Coding file.

func Aaf

func Aaf(in []byte, _ uint32) bool

Aaf matches an Advanced Authoring Format file. See: https://pyaaf.readthedocs.io/en/latest/about.html See: https://en.wikipedia.org/wiki/Advanced_Authoring_Format

func Aiff

func Aiff(in []byte, _ uint32) bool

Aiff matches Audio Interchange File Format file.

func Amf

func Amf(in []byte, _ uint32) bool

Amf matches an Additive Manufacturing XML file.

func Amr

func Amr(in []byte, _ uint32) bool

Amr matches an Adaptive Multi-Rate file.

func Ape

func Ape(in []byte, _ uint32) bool

Ape matches a Monkey's Audio file.

func Ar

func Ar(in []byte, _ uint32) bool

Ar matches an ar (Unix) archive file.

func Asf

func Asf(in []byte, _ uint32) bool

Asf matches an Advanced Systems Format file.

func Atom

func Atom(in []byte, _ uint32) bool

Atom matches an Atom Syndication Format file.

func Au

func Au(in []byte, _ uint32) bool

Au matches a Sun Microsystems au file.

func Avi

func Avi(in []byte, _ uint32) bool

Avi matches an Audio Video Interleaved file.

func Bmp

func Bmp(in []byte, _ uint32) bool

Bmp matches a bitmap image file.

func Bpg

func Bpg(in []byte, _ uint32) bool

Bpg matches a Better Portable Graphics file.

func Bz2

func Bz2(in []byte, _ uint32) bool

Bz2 matches a bzip2 file.

func Cab

func Cab(in []byte, _ uint32) bool

Cab matches a Cabinet archive file.

func Class

func Class(in []byte, _ uint32) bool

Class matches a java class file.

func Collada

func Collada(in []byte, _ uint32) bool

Collada matches a COLLAborative Design Activity file.

func Cpio

func Cpio(in []byte, _ uint32) bool

Cpio matches a cpio archive file

func Crx

func Crx(in []byte, _ uint32) bool

Crx matches a Chrome extension file: a zip archive prepended by "Cr24".

func Csv

func Csv(in []byte, _ uint32) bool

Csv matches a comma-separated values file.

func Dbf

func Dbf(in []byte, _ uint32) bool

Dbf matches a dBase file. https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm

func Dcm

func Dcm(in []byte, _ uint32) bool

Dcm matches a DICOM medical format file.

func Deb

func Deb(in []byte, _ uint32) bool

Deb matches a Debian package file.

func DjVu

func DjVu(in []byte, _ uint32) bool

DjVu matches a DjVu file.

func Doc

func Doc(in []byte, _ uint32) bool

Doc matches a Microsoft Word 97-2003 file.

BUG(gabriel-vasile): Doc should look for subheaders like Ppt and Xls does.

Ole is a container for Doc, Ppt, Pub and Xls. Right now, when an Ole file is detected, it is considered to be a Doc file if the checks for Ppt, Pub and Xls failed.

func Docx

func Docx(in []byte, _ uint32) bool

Docx matches a Microsoft Word 2007 file.

func Dwg

func Dwg(in []byte, _ uint32) bool

Dwg matches a CAD drawing file.

func Elf

func Elf(in []byte, _ uint32) bool

Elf matches an Executable and Linkable Format file.

func ElfDump

func ElfDump(in []byte, _ uint32) bool

ElfDump matches a core dump file.

func ElfExe

func ElfExe(in []byte, _ uint32) bool

ElfExe matches an executable file.

func ElfLib

func ElfLib(in []byte, _ uint32) bool

ElfLib matches a shared library file.

func ElfObj

func ElfObj(in []byte, _ uint32) bool

ElfObj matches an object file.

func Eot

func Eot(in []byte, _ uint32) bool

Eot matches an Embedded OpenType font file.

func Epub

func Epub(in []byte, _ uint32) bool

Epub matches an EPUB file.

func Exe

func Exe(in []byte, _ uint32) bool

Exe matches a Windows/DOS executable file.

func Fdf

func Fdf(in []byte, _ uint32) bool

Fdf matches a Forms Data Format file.

func Fits

func Fits(in []byte, _ uint32) bool

Fits matches an Flexible Image Transport System file.

func Flac

func Flac(in []byte, _ uint32) bool

Flac matches a Free Lossless Audio Codec file.

func Flv

func Flv(in []byte, _ uint32) bool

Flv matches a Flash video file.

func Gbr

func Gbr(in []byte, _ uint32) bool

Gbr matches GIMP brush data.

func GeoJson

func GeoJson(in []byte, _ uint32) bool

GeoJson matches a RFC 7946 GeoJSON file.

GeoJson detection implies searching for key:value pairs like: `"type": "Feature"` in the input. BUG(gabriel-vasile): The "type" key should be searched for in the root object.

func Gif

func Gif(in []byte, _ uint32) bool

Gif matches a Graphics Interchange Format file.

func Glb

func Glb(in []byte, _ uint32) bool

Glb matches a glTF model format file.

func Gml

func Gml(in []byte, _ uint32) bool

Gml matches a Geography Markup Language file.

func Gpx

func Gpx(in []byte, _ uint32) bool

Gpx matches a GPS Exchange Format file.

func Gzip

func Gzip(in []byte, _ uint32) bool

Gzip matched gzip files based on http://www.zlib.org/rfc-gzip.html#header-trailer.

func Hdr

func Hdr(in []byte, _ uint32) bool

Hdr matches Radiance HDR image. https://web.archive.org/web/20060913152809/http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/

func Heic

func Heic(in []byte, _ uint32) bool

Heic matches a High Efficiency Image Coding (HEIC) file.

func HeicSequence

func HeicSequence(in []byte, _ uint32) bool

HeicSequence matches a High Efficiency Image Coding (HEIC) file sequence.

func Heif

func Heif(in []byte, _ uint32) bool

Heif matches a High Efficiency Image File Format (HEIF) file.

func HeifSequence

func HeifSequence(in []byte, _ uint32) bool

HeifSequence matches a High Efficiency Image File Format (HEIF) file sequence.

func Html

func Html(in []byte, _ uint32) bool

Html matches a Hypertext Markup Language file.

func ICalendar

func ICalendar(in []byte, _ uint32) bool

ICalendar matches a iCalendar file.

func Icns

func Icns(in []byte, _ uint32) bool

Icns matches an ICNS (Apple Icon Image format) file.

func Ico

func Ico(in []byte, _ uint32) bool

Ico matches an ICO file.

func Jar

func Jar(in []byte, _ uint32) bool

Jar matches a Java archive file.

func Jp2

func Jp2(in []byte, _ uint32) bool

Jp2 matches a JPEG 2000 Image file (ISO 15444-1).

func Jpg

func Jpg(in []byte, _ uint32) bool

Jpg matches a Joint Photographic Experts Group file.

func Jpm

func Jpm(in []byte, _ uint32) bool

Jpm matches a JPEG 2000 Image file (ISO 15444-6).

func Jpx

func Jpx(in []byte, _ uint32) bool

Jpx matches a JPEG 2000 Image file (ISO 15444-2).

func Js

func Js(in []byte, _ uint32) bool

Js matches a Javascript file.

func Json

func Json(in []byte, readLimit uint32) bool

Json matches a JavaScript Object Notation file.

func Kml

func Kml(in []byte, _ uint32) bool

Kml matches a Keyhole Markup Language file.

func Lit

func Lit(in []byte, _ uint32) bool

Lit matches a Microsoft Lit file.

func Lua

func Lua(in []byte, _ uint32) bool

Lua matches a Lua programming language file.

func Lzip

func Lzip(in []byte, _ uint32) bool

Lzip matches an Lzip compressed file.

func M3u

func M3u(in []byte, _ uint32) bool

M3u matches a Playlist file.

func M4a

func M4a(in []byte, _ uint32) bool

M4a matches an audio M4A file.

func M4v

func M4v(in []byte, _ uint32) bool

M4v matches an Appl4 M4V video file.

func MachO

func MachO(in []byte, _ uint32) bool

MachO matches Mach-O binaries format.

func Marc

func Marc(in []byte, _ uint32) bool

Marc matches a MARC21 (MAchine-Readable Cataloging) file.

func Midi

func Midi(in []byte, _ uint32) bool

Midi matches a Musical Instrument Digital Interface file.

func Mkv

func Mkv(in []byte, _ uint32) bool

Mkv matches a mkv file.

func Mobi

func Mobi(in []byte, _ uint32) bool

Mobi matches a Mobi file.

func Mp3

func Mp3(in []byte, _ uint32) bool

Mp3 matches an mp3 file.

func Mp4

func Mp4(in []byte, _ uint32) bool

Mp4 matches an MP4 file.

func Mpeg

func Mpeg(in []byte, _ uint32) bool

Mpeg matches a Moving Picture Experts Group file.

func Mqv

func Mqv(in []byte, _ uint32) bool

Mqv matches a Sony / Mobile QuickTime file.

func MsAccessAce

func MsAccessAce(in []byte, _ uint32) bool

MsAccessAce matches Microsoft Access dababase file.

func MsAccessMdb

func MsAccessMdb(in []byte, _ uint32) bool

MsAccessMdb matches legacy Microsoft Access database file (JET, 2003 and earlier).

func Msg

func Msg(in []byte, _ uint32) bool

Msg matches a Microsoft Outlook email file.

func MusePack

func MusePack(in []byte, _ uint32) bool

MusePack matches a Musepack file.

func NdJson

func NdJson(in []byte, readLimit uint32) bool

NdJson matches a Newline delimited JSON file.

func Nes

func Nes(in []byte, _ uint32) bool

Nes matches a Nintendo Entertainment system ROM file.

func Odc

func Odc(in []byte, _ uint32) bool

Odc matches an OpenDocument Chart file.

func Odf

func Odf(in []byte, _ uint32) bool

Odf matches an OpenDocument Formula file.

func Odg

func Odg(in []byte, _ uint32) bool

Odg matches an OpenDocument Drawing file.

func Odp

func Odp(in []byte, _ uint32) bool

Odp matches an OpenDocument Presentation file.

func Ods

func Ods(in []byte, _ uint32) bool

Ods matches an OpenDocument Spreadsheet file.

func Odt

func Odt(in []byte, _ uint32) bool

Odt matches an OpenDocument Text file.

func Ogg

func Ogg(in []byte, _ uint32) bool

Ogg matches an Ogg file.

func OggAudio

func OggAudio(in []byte, _ uint32) bool

OggAudio matches an audio ogg file.

func OggVideo

func OggVideo(in []byte, _ uint32) bool

OggVideo matches a video ogg file.

func Ole

func Ole(in []byte, _ uint32) bool

Ole matches an Open Linking and Embedding file.

https://en.wikipedia.org/wiki/Object_Linking_and_Embedding

func Otf

func Otf(in []byte, _ uint32) bool

Otf matches an OpenType font file.

func Otg

func Otg(in []byte, _ uint32) bool

Otg matches an OpenDocument Drawing Template file.

func Otp

func Otp(in []byte, _ uint32) bool

Otp matches an OpenDocument Presentation Template file.

func Ots

func Ots(in []byte, _ uint32) bool

Ots matches an OpenDocument Spreadsheet Template file.

func Ott

func Ott(in []byte, _ uint32) bool

Ott matches an OpenDocument Text Template file.

func Owl2

func Owl2(in []byte, _ uint32) bool

Owl2 matches an Owl ontology file.

func P7s

func P7s(in []byte, _ uint32) bool

P7s matches an .p7s signature File (PEM, Base64).

func Pat

func Pat(in []byte, _ uint32) bool

Pat matches GIMP pattern data.

func Pdf

func Pdf(in []byte, _ uint32) bool

Pdf matches a Portable Document Format file.

func Perl

func Perl(in []byte, _ uint32) bool

Perl matches a Perl programming language file.

func Php

func Php(in []byte, _ uint32) bool

Php matches a PHP: Hypertext Preprocessor file.

func Png

func Png(in []byte, _ uint32) bool

Png matches a Portable Network Graphics file.

func Ppt

func Ppt(in []byte, _ uint32) bool

Ppt matches a Microsoft PowerPoint 97-2003 file or a PowerPoint 95 presentation.

func Pptx

func Pptx(in []byte, _ uint32) bool

Pptx matches a Microsoft PowerPoint 2007 file.

func Ps

func Ps(in []byte, _ uint32) bool

Ps matches a PostScript file.

func Psd

func Psd(in []byte, _ uint32) bool

Psd matches a Photoshop Document file.

func Pub

func Pub(in []byte, _ uint32) bool

Pub matches a Microsoft Publisher file.

func Python

func Python(in []byte, _ uint32) bool

Python matches a Python programming language file.

func Qcp

func Qcp(in []byte, _ uint32) bool

Qcp matches a Qualcomm Pure Voice file.

func QuickTime

func QuickTime(in []byte, _ uint32) bool

QuickTime matches a QuickTime File Format file.

func Rar

func Rar(in []byte, _ uint32) bool

Rar matches a RAR archive file.

func Rmvb

func Rmvb(in []byte, _ uint32) bool

Rmvb matches a RealMedia Variable Bitrate file.

func Rpm

func Rpm(in []byte, _ uint32) bool

Rpm matches an RPM or Delta RPM package file.

func Rss

func Rss(in []byte, _ uint32) bool

Rss matches a Rich Site Summary file.

func Rtf

func Rtf(in []byte, _ uint32) bool

Rtf matches a Rich Text Format file.

func SevenZ

func SevenZ(in []byte, _ uint32) bool

SevenZ matches a 7z archive.

func Shp

func Shp(in []byte, _ uint32) bool

Shp matches a shape format file. https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf

func Shx

func Shx(in []byte, _ uint32) bool

Shx matches a shape index format file. https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf

func Sqlite

func Sqlite(in []byte, _ uint32) bool

Sqlite matches an SQLite database file.

func Svg

func Svg(in []byte, _ uint32) bool

Svg matches a SVG file.

func Swf

func Swf(in []byte, _ uint32) bool

Swf matches an Adobe Flash swf file.

func Sxc

func Sxc(in []byte, _ uint32) bool

Sxc matches an OpenOffice Spreadsheet file.

func Tar

func Tar(in []byte, _ uint32) bool

Tar matches a (t)ape (ar)chive file.

func Tcl

func Tcl(in []byte, _ uint32) bool

Tcl matches a Tcl programming language file.

func Tcx

func Tcx(in []byte, _ uint32) bool

Tcx matches a Training Center XML file.

func ThreeG2

func ThreeG2(in []byte, _ uint32) bool

ThreeG2 matches a 3GPP2 file.

func ThreeGP

func ThreeGP(in []byte, _ uint32) bool

ThreeGP matches a 3GPP file.

func Threemf

func Threemf(in []byte, _ uint32) bool

Threemf matches a 3D Manufacturing Format file.

func Tiff

func Tiff(in []byte, _ uint32) bool

Tiff matches a Tagged Image File Format file.

func Torrent

func Torrent(in []byte, _ uint32) bool

Torrent has bencoded text in the beginning

func Tsv

func Tsv(in []byte, _ uint32) bool

Tsv matches a tab-separated values file.

func Ttf

func Ttf(in []byte, _ uint32) bool

Ttf matches a TrueType font file.

func TzIf

func TzIf(in []byte, _ uint32) bool

TzIf matches a Time Zone Information Format (TZif) file.

func Utf16be

func Utf16be(in []byte, _ uint32) bool

Utf16be matches a text file encoded with UTF-16 and with the characters represented in big endian.

func Utf16le

func Utf16le(in []byte, _ uint32) bool

Utf16le matches a text file encoded with UTF-16 and with the characters represented in little endian.

func Utf32be

func Utf32be(in []byte, _ uint32) bool

Utf32be matches a text file encoded with UTF-32 and with the characters represented in big endian.

func Utf32le

func Utf32le(in []byte, _ uint32) bool

Utf32le matches a text file encoded with UTF-32 and with the characters represented in little endian.

func Utf8

func Utf8(in []byte, _ uint32) bool

Utf8 matches an UTF-8 text file.

func VCard

func VCard(in []byte, _ uint32) bool

VCard matches a Virtual Contact File.

func Voc

func Voc(in []byte, _ uint32) bool

Voc matches a Creative Voice file.

func Warc

func Warc(in []byte, _ uint32) bool

Warc matches a Web ARChive file.

func Wasm

func Wasm(in []byte, _ uint32) bool

Wasm matches a web assembly File Format file.

func Wav

func Wav(in []byte, _ uint32) bool

Wav matches a Waveform Audio File Format file.

func WebM

func WebM(in []byte, _ uint32) bool

WebM matches a WebM file.

func Webp

func Webp(in []byte, _ uint32) bool

Webp matches a WebP file.

func Woff

func Woff(in []byte, _ uint32) bool

Woff matches a Web Open Font Format file.

func Woff2

func Woff2(in []byte, _ uint32) bool

Woff2 matches a Web Open Font Format version 2 file.

func X3d

func X3d(in []byte, _ uint32) bool

X3d matches an Extensible 3D Graphics file.

func Xar

func Xar(in []byte, _ uint32) bool

Xar matches an eXtensible ARchive format file.

func Xcf

func Xcf(in []byte, _ uint32) bool

Xcf matches GIMP image data.

func Xfdf

func Xfdf(in []byte, _ uint32) bool

Xfdf matches a XML Forms Data Format file.

func Xliff

func Xliff(in []byte, _ uint32) bool

Xliff matches a XML Localization Interchange File Format file.

func Xls

func Xls(in []byte, _ uint32) bool

Xls matches a Microsoft Excel 97-2003 file.

func Xlsx

func Xlsx(in []byte, _ uint32) bool

Xlsx matches a Microsoft Excel 2007 file.

func Xml

func Xml(in []byte, _ uint32) bool

Xml matches an Extensible Markup Language file.

func Xz

func Xz(in []byte, _ uint32) bool

Xz matches an xz compressed stream based on https://tukaani.org/xz/xz-file-format.txt.

func Zip

func Zip(in []byte, _ uint32) bool

Zip matches a zip archive.

func Zstd

func Zstd(in []byte, _ uint32) bool

Zstd matches a Zstandard archive file.

Bugs

Doc should look for subheaders like Ppt and Xls does. Ole is a container for Doc, Ppt, Pub and Xls. Right now, when an Ole file is detected, it is considered to be a Doc file if the checks for Ppt, Pub and Xls failed.

The "type" key should be searched for in the root object.

Source Files

archive.go audio.go binary.go database.go document.go font.go ftyp.go geo.go image.go matchers.go model.go ms_office.go ogg.go signature.go text.go text_csv.go torrent.go video.go zip.go

Version
v1.2.0
Published
Mar 1, 2021
Platform
js/wasm
Imports
8 packages
Last checked
10 minutes ago

Tools for package owners.