Documentation ¶
Overview ¶
Package magic holds the matching functions used to find MIME types.
Index ¶
- Variables
- func Aaf(raw []byte, limit uint32) bool
- func Aiff(raw []byte, limit uint32) bool
- func Avi(raw []byte, limit uint32) bool
- func CRX(raw []byte, limit uint32) bool
- func Class(raw []byte, limit uint32) bool
- func Csv(raw []byte, limit uint32) bool
- func Dbf(raw []byte, limit uint32) bool
- func Dcm(raw []byte, limit uint32) bool
- func DjVu(raw []byte, limit uint32) bool
- func Doc(raw []byte, _ uint32) bool
- func Docx(raw []byte, limit uint32) bool
- func Dwg(raw []byte, _ uint32) bool
- func ElfDump(raw []byte, limit uint32) bool
- func ElfExe(raw []byte, limit uint32) bool
- func ElfLib(raw []byte, limit uint32) bool
- func ElfObj(raw []byte, limit uint32) bool
- func Eot(raw []byte, limit uint32) bool
- func GeoJSON(raw []byte, limit uint32) bool
- func HAR(raw []byte, limit uint32) bool
- func InstallShieldCab(raw []byte, _ uint32) bool
- func JSON(raw []byte, limit uint32) bool
- func Jar(raw []byte, limit uint32) bool
- func Jxl(raw []byte, _ uint32) bool
- func MachO(raw []byte, limit uint32) bool
- func Marc(raw []byte, limit uint32) bool
- func Mkv(raw []byte, limit uint32) bool
- func Mp3(raw []byte, limit uint32) bool
- func Mpeg(raw []byte, limit uint32) bool
- func Msg(raw []byte, limit uint32) bool
- func Msi(raw []byte, limit uint32) bool
- func NdJSON(raw []byte, limit uint32) bool
- func Ogg(raw []byte, limit uint32) bool
- func OggAudio(raw []byte, limit uint32) bool
- func OggVideo(raw []byte, limit uint32) bool
- func Ole(raw []byte, limit uint32) bool
- func P7s(raw []byte, limit uint32) bool
- func Php(raw []byte, limit uint32) bool
- func Ppt(raw []byte, limit uint32) bool
- func Pptx(raw []byte, limit uint32) bool
- func Pub(raw []byte, limit uint32) bool
- func Qcp(raw []byte, limit uint32) bool
- func QuickTime(raw []byte, _ uint32) bool
- func Shp(raw []byte, limit uint32) bool
- func Shx(raw []byte, limit uint32) bool
- func Srt(raw []byte, _ uint32) bool
- func Svg(raw []byte, limit uint32) bool
- func Tar(raw []byte, _ uint32) bool
- func Text(raw []byte, limit uint32) bool
- func Tsv(raw []byte, limit uint32) bool
- func Ttc(raw []byte, limit uint32) bool
- func Ttf(raw []byte, limit uint32) bool
- func TzIf(raw []byte, limit uint32) bool
- func Vtt(raw []byte, limit uint32) bool
- func Wav(raw []byte, limit uint32) bool
- func WebM(raw []byte, limit uint32) bool
- func Webp(raw []byte, _ uint32) bool
- func Xls(raw []byte, limit uint32) bool
- func Xlsx(raw []byte, limit uint32) bool
- func Zip(raw []byte, limit uint32) bool
- func Zstd(raw []byte, limit uint32) bool
- type Detector
- Bugs
Constants ¶
This section is empty.
Variables ¶
var ( // SevenZ matches a 7z archive. SevenZ = prefix([]byte{0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C}) // Gzip matches gzip files based on http://www.zlib.org/rfc-gzip.html#header-trailer. Gzip = prefix([]byte{0x1f, 0x8b}) // Fits matches an Flexible Image Transport System file. Fits = prefix([]byte{ 0x53, 0x49, 0x4D, 0x50, 0x4C, 0x45, 0x20, 0x20, 0x3D, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x54, }) // Xar matches an eXtensible ARchive format file. Xar = prefix([]byte{0x78, 0x61, 0x72, 0x21}) // Bz2 matches a bzip2 file. Bz2 = prefix([]byte{0x42, 0x5A, 0x68}) // Ar matches an ar (Unix) archive file. Ar = prefix([]byte{0x21, 0x3C, 0x61, 0x72, 0x63, 0x68, 0x3E}) // Deb matches a Debian package file. Deb = offset([]byte{ 0x64, 0x65, 0x62, 0x69, 0x61, 0x6E, 0x2D, 0x62, 0x69, 0x6E, 0x61, 0x72, 0x79, }, 8) // Warc matches a Web ARChive file. Warc = prefix([]byte("WARC/1.0"), []byte("WARC/1.1")) // Cab matches a Microsoft Cabinet archive file. Cab = prefix([]byte("MSCF\x00\x00\x00\x00")) // Xz matches an xz compressed stream based on https://tukaani.org/xz/xz-file-format.txt. Xz = prefix([]byte{0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00}) // Lzip matches an Lzip compressed file. Lzip = prefix([]byte{0x4c, 0x5a, 0x49, 0x50}) // RPM matches an RPM or Delta RPM package file. RPM = prefix([]byte{0xed, 0xab, 0xee, 0xdb}, []byte("drpm")) // Cpio matches a cpio archive file. Cpio = prefix([]byte("070707"), []byte("070701"), []byte("070702")) // RAR matches a RAR archive file. RAR = prefix([]byte("Rar!\x1A\x07\x00"), []byte("Rar!\x1A\x07\x01\x00")) )
var ( // Flac matches a Free Lossless Audio Codec file. Flac = prefix([]byte("\x66\x4C\x61\x43\x00\x00\x00\x22")) // Midi matches a Musical Instrument Digital Interface file. Midi = prefix([]byte("\x4D\x54\x68\x64")) // Ape matches a Monkey's Audio file. Ape = prefix([]byte("\x4D\x41\x43\x20\x96\x0F\x00\x00\x34\x00\x00\x00\x18\x00\x00\x00\x90\xE3")) // MusePack matches a Musepack file. MusePack = prefix([]byte("MPCK")) // Au matches a Sun Microsystems au file. Au = prefix([]byte("\x2E\x73\x6E\x64")) // Amr matches an Adaptive Multi-Rate file. Amr = prefix([]byte("\x23\x21\x41\x4D\x52")) // Voc matches a Creative Voice file. Voc = prefix([]byte("Creative Voice File")) // M3u matches a Playlist file. M3u = prefix([]byte("#EXTM3U")) // AAC matches an Advanced Audio Coding file. AAC = prefix([]byte{0xFF, 0xF1}, []byte{0xFF, 0xF9}) )
var ( // Lnk matches Microsoft lnk binary format. Lnk = prefix([]byte{0x4C, 0x00, 0x00, 0x00, 0x01, 0x14, 0x02, 0x00}) // Wasm matches a web assembly File Format file. Wasm = prefix([]byte{0x00, 0x61, 0x73, 0x6D}) // Exe matches a Windows/DOS executable file. Exe = prefix([]byte{0x4D, 0x5A}) // Elf matches an Executable and Linkable Format file. Elf = prefix([]byte{0x7F, 0x45, 0x4C, 0x46}) // Nes matches a Nintendo Entertainment system ROM file. Nes = prefix([]byte{0x4E, 0x45, 0x53, 0x1A}) // SWF matches an Adobe Flash swf file. SWF = prefix([]byte("CWS"), []byte("FWS"), []byte("ZWS")) // Torrent has bencoded text in the beginning. Torrent = prefix([]byte("d8:announce")) )
var ( // Sqlite matches an SQLite database file. Sqlite = prefix([]byte{ 0x53, 0x51, 0x4c, 0x69, 0x74, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x33, 0x00, }) // MsAccessAce matches Microsoft Access dababase file. MsAccessAce = offset([]byte("Standard ACE DB"), 4) // MsAccessMdb matches legacy Microsoft Access database file (JET, 2003 and earlier). MsAccessMdb = offset([]byte("Standard Jet DB"), 4) )
var ( // Pdf matches a Portable Document Format file. // https://github.com/file/file/blob/11010cc805546a3e35597e67e1129a481aed40e8/magic/Magdir/pdf Pdf = prefix( []byte("%PDF-"), []byte("\012%PDF-"), []byte("\xef\xbb\xbf%PDF-"), ) // Fdf matches a Forms Data Format file. Fdf = prefix([]byte("%FDF")) // Mobi matches a Mobi file. Mobi = offset([]byte("BOOKMOBI"), 60) // Lit matches a Microsoft Lit file. Lit = prefix([]byte("ITOLITLS")) )
var ( // Woff matches a Web Open Font Format file. Woff = prefix([]byte("wOFF")) // Woff2 matches a Web Open Font Format version 2 file. Woff2 = prefix([]byte("wOF2")) // Otf matches an OpenType font file. Otf = prefix([]byte{0x4F, 0x54, 0x54, 0x4F, 0x00}) )
var ( // AVIF matches an AV1 Image File Format still or animated. // Wikipedia page seems outdated listing image/avif-sequence for animations. // https://github.com/AOMediaCodec/av1-avif/issues/59 AVIF = ftyp([]byte("avif"), []byte("avis")) // Mp4 matches an MP4 file. Mp4 = ftyp( []byte("avc1"), []byte("dash"), []byte("iso2"), []byte("iso3"), []byte("iso4"), []byte("iso5"), []byte("iso6"), []byte("isom"), []byte("mmp4"), []byte("mp41"), []byte("mp42"), []byte("mp4v"), []byte("mp71"), []byte("MSNV"), []byte("NDAS"), []byte("NDSC"), []byte("NSDC"), []byte("NSDH"), []byte("NDSM"), []byte("NDSP"), []byte("NDSS"), []byte("NDXC"), []byte("NDXH"), []byte("NDXM"), []byte("NDXP"), []byte("NDXS"), []byte("F4V "), []byte("F4P "), ) // ThreeGP matches a 3GPP file. ThreeGP = ftyp( []byte("3gp1"), []byte("3gp2"), []byte("3gp3"), []byte("3gp4"), []byte("3gp5"), []byte("3gp6"), []byte("3gp7"), []byte("3gs7"), []byte("3ge6"), []byte("3ge7"), []byte("3gg6"), ) // ThreeG2 matches a 3GPP2 file. ThreeG2 = ftyp( []byte("3g24"), []byte("3g25"), []byte("3g26"), []byte("3g2a"), []byte("3g2b"), []byte("3g2c"), []byte("KDDI"), ) // AMp4 matches an audio MP4 file. AMp4 = ftyp( []byte("F4A "), []byte("F4B "), []byte("M4B "), []byte("M4P "), []byte("MSNV"), []byte("NDAS"), ) // Mqv matches a Sony / Mobile QuickTime file. Mqv = ftyp([]byte("mqt ")) // M4a matches an audio M4A file. M4a = ftyp([]byte("M4A ")) // M4v matches an Appl4 M4V video file. M4v = ftyp([]byte("M4V "), []byte("M4VH"), []byte("M4VP")) // Heic matches a High Efficiency Image Coding (HEIC) file. Heic = ftyp([]byte("heic"), []byte("heix")) // HeicSequence matches a High Efficiency Image Coding (HEIC) file sequence. HeicSequence = ftyp([]byte("hevc"), []byte("hevx")) // Heif matches a High Efficiency Image File Format (HEIF) file. Heif = ftyp([]byte("mif1"), []byte("heim"), []byte("heis"), []byte("avic")) // HeifSequence matches a High Efficiency Image File Format (HEIF) file sequence. HeifSequence = ftyp([]byte("msf1"), []byte("hevm"), []byte("hevs"), []byte("avcs")) )
var ( // Png matches a Portable Network Graphics file. // https://www.w3.org/TR/PNG/ Png = prefix([]byte{0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A}) // Apng matches an Animated Portable Network Graphics file. // https://wiki.mozilla.org/APNG_Specification Apng = offset([]byte("acTL"), 37) // Jpg matches a Joint Photographic Experts Group file. Jpg = prefix([]byte{0xFF, 0xD8, 0xFF}) // Jp2 matches a JPEG 2000 Image file (ISO 15444-1). Jp2 = jpeg2k([]byte{0x6a, 0x70, 0x32, 0x20}) // Jpx matches a JPEG 2000 Image file (ISO 15444-2). Jpx = jpeg2k([]byte{0x6a, 0x70, 0x78, 0x20}) // Jpm matches a JPEG 2000 Image file (ISO 15444-6). Jpm = jpeg2k([]byte{0x6a, 0x70, 0x6D, 0x20}) // Gif matches a Graphics Interchange Format file. Gif = prefix([]byte("GIF87a"), []byte("GIF89a")) // Bmp matches a bitmap image file. Bmp = prefix([]byte{0x42, 0x4D}) // Ps matches a PostScript file. Ps = prefix([]byte("%!PS-Adobe-")) // Psd matches a Photoshop Document file. Psd = prefix([]byte("8BPS")) // Ico matches an ICO file. Ico = prefix([]byte{0x00, 0x00, 0x01, 0x00}, []byte{0x00, 0x00, 0x02, 0x00}) // Icns matches an ICNS (Apple Icon Image format) file. Icns = prefix([]byte("icns")) // Tiff matches a Tagged Image File Format file. Tiff = prefix([]byte{0x49, 0x49, 0x2A, 0x00}, []byte{0x4D, 0x4D, 0x00, 0x2A}) // Bpg matches a Better Portable Graphics file. Bpg = prefix([]byte{0x42, 0x50, 0x47, 0xFB}) // Xcf matches GIMP image data. Xcf = prefix([]byte("gimp xcf")) // Pat matches GIMP pattern data. Pat = offset([]byte("GPAT"), 20) // Gbr matches GIMP brush data. Gbr = offset([]byte("GIMP"), 20) // Hdr matches Radiance HDR image. // https://web.archive.org/web/20060913152809/http://local.wasp.uwa.edu.au/~pbourke/dataformats/pic/ Hdr = prefix([]byte("#?RADIANCE\n")) // Xpm matches X PixMap image data. Xpm = prefix([]byte{0x2F, 0x2A, 0x20, 0x58, 0x50, 0x4D, 0x20, 0x2A, 0x2F}) // Jxs matches a JPEG XS coded image file (ISO/IEC 21122-3). Jxs = prefix([]byte{0x00, 0x00, 0x00, 0x0C, 0x4A, 0x58, 0x53, 0x20, 0x0D, 0x0A, 0x87, 0x0A}) // Jxr matches Microsoft HD JXR photo file. Jxr = prefix([]byte{0x49, 0x49, 0xBC, 0x01}) )
var ( // HTML matches a Hypertext Markup Language file. HTML = markup( []byte("<!DOCTYPE HTML"), []byte("<HTML"), []byte("<HEAD"), []byte("<SCRIPT"), []byte("<IFRAME"), []byte("<H1"), []byte("<DIV"), []byte("<FONT"), []byte("<TABLE"), []byte("<A"), []byte("<STYLE"), []byte("<TITLE"), []byte("<B"), []byte("<BODY"), []byte("<BR"), []byte("<P"), ) // XML matches an Extensible Markup Language file. XML = markup([]byte("<?XML")) // Owl2 matches an Owl ontology file. Owl2 = xml(newXMLSig("Ontology", `xmlns="http://www.w3.org/2002/07/owl#"`)) // Rss matches a Rich Site Summary file. Rss = xml(newXMLSig("rss", "")) // Atom matches an Atom Syndication Format file. Atom = xml(newXMLSig("feed", `xmlns="http://www.w3.org/2005/Atom"`)) // Kml matches a Keyhole Markup Language file. Kml = xml( newXMLSig("kml", `xmlns="http://www.opengis.net/kml/2.2"`), newXMLSig("kml", `xmlns="http://earth.google.com/kml/2.0"`), newXMLSig("kml", `xmlns="http://earth.google.com/kml/2.1"`), newXMLSig("kml", `xmlns="http://earth.google.com/kml/2.2"`), ) // Xliff matches a XML Localization Interchange File Format file. Xliff = xml(newXMLSig("xliff", `xmlns="urn:oasis:names:tc:xliff:document:1.2"`)) // Collada matches a COLLAborative Design Activity file. Collada = xml(newXMLSig("COLLADA", `xmlns="http://www.collada.org/2005/11/COLLADASchema"`)) // Gml matches a Geography Markup Language file. Gml = xml( newXMLSig("", `xmlns:gml="http://www.opengis.net/gml"`), newXMLSig("", `xmlns:gml="http://www.opengis.net/gml/3.2"`), newXMLSig("", `xmlns:gml="http://www.opengis.net/gml/3.3/exr"`), ) // Gpx matches a GPS Exchange Format file. Gpx = xml(newXMLSig("gpx", `xmlns="http://www.topografix.com/GPX/1/1"`)) // Tcx matches a Training Center XML file. Tcx = xml(newXMLSig("TrainingCenterDatabase", `xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"`)) // X3d matches an Extensible 3D Graphics file. X3d = xml(newXMLSig("X3D", `xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance"`)) // Amf matches an Additive Manufacturing XML file. Amf = xml(newXMLSig("amf", "")) // Threemf matches a 3D Manufacturing Format file. Threemf = xml(newXMLSig("model", `xmlns="http://schemas.microsoft.com/3dmanufacturing/core/2015/02"`)) // Xfdf matches a XML Forms Data Format file. Xfdf = xml(newXMLSig("xfdf", `xmlns="http://ns.adobe.com/xfdf/"`)) // VCard matches a Virtual Contact File. VCard = ciPrefix([]byte("BEGIN:VCARD\n"), []byte("BEGIN:VCARD\r\n")) // ICalendar matches a iCalendar file. ICalendar = ciPrefix([]byte("BEGIN:VCALENDAR\n"), []byte("BEGIN:VCALENDAR\r\n")) // Js matches a Javascript file. Js = shebang( []byte("/bin/node"), []byte("/usr/bin/node"), []byte("/bin/nodejs"), []byte("/usr/bin/nodejs"), []byte("/usr/bin/env node"), []byte("/usr/bin/env nodejs"), ) // Lua matches a Lua programming language file. Lua = shebang( []byte("/usr/bin/lua"), []byte("/usr/local/bin/lua"), []byte("/usr/bin/env lua"), ) // Perl matches a Perl programming language file. Perl = shebang( []byte("/usr/bin/perl"), []byte("/usr/bin/env perl"), ) // Python matches a Python programming language file. Python = shebang( []byte("/usr/bin/python"), []byte("/usr/local/bin/python"), []byte("/usr/bin/env python"), ) // Tcl matches a Tcl programming language file. Tcl = shebang( []byte("/usr/bin/tcl"), []byte("/usr/local/bin/tcl"), []byte("/usr/bin/env tcl"), []byte("/usr/bin/tclsh"), []byte("/usr/local/bin/tclsh"), []byte("/usr/bin/env tclsh"), []byte("/usr/bin/wish"), []byte("/usr/local/bin/wish"), []byte("/usr/bin/env wish"), ) // Rtf matches a Rich Text Format file. Rtf = prefix([]byte("{\\rtf1")) )
var ( // Flv matches a Flash video file. Flv = prefix([]byte("\x46\x4C\x56\x01")) // Asf matches an Advanced Systems Format file. Asf = prefix([]byte{ 0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C, }) // Rmvb matches a RealMedia Variable Bitrate file. Rmvb = prefix([]byte{0x2E, 0x52, 0x4D, 0x46}) )
var ( // Odt matches an OpenDocument Text file. Odt = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.text"), 30) // Ott matches an OpenDocument Text Template file. Ott = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.text-template"), 30) // Ods matches an OpenDocument Spreadsheet file. Ods = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.spreadsheet"), 30) // Ots matches an OpenDocument Spreadsheet Template file. Ots = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.spreadsheet-template"), 30) // Odp matches an OpenDocument Presentation file. Odp = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.presentation"), 30) // Otp matches an OpenDocument Presentation Template file. Otp = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.presentation-template"), 30) // Odg matches an OpenDocument Drawing file. Odg = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.graphics"), 30) // Otg matches an OpenDocument Drawing Template file. Otg = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.graphics-template"), 30) // Odf matches an OpenDocument Formula file. Odf = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.formula"), 30) // Odc matches an OpenDocument Chart file. Odc = offset([]byte("mimetypeapplication/vnd.oasis.opendocument.chart"), 30) // Epub matches an EPUB file. Epub = offset([]byte("mimetypeapplication/epub+zip"), 30) // Sxc matches an OpenOffice Spreadsheet file. Sxc = offset([]byte("mimetypeapplication/vnd.sun.xml.calc"), 30) )
var Glb = prefix([]byte("\x67\x6C\x54\x46\x02\x00\x00\x00"), []byte("\x67\x6C\x54\x46\x01\x00\x00\x00"))
Glb matches a glTF model format file. GLB is the binary file format representation of 3D models saved in the GL transmission Format (glTF). GLB uses little endian and its header structure is as follows:
<-- 12-byte header --> | magic | version | length | | (uint32) | (uint32) | (uint32) | | \x67\x6C\x54\x46 | \x01\x00\x00\x00 | ... | | g l T F | 1 | ... |
Visit glTF specification and IANA glTF entry for more details.
Functions ¶
func Aaf ¶
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 Dbf ¶
Dbf matches a dBase file. https://www.dbase.com/Knowledgebase/INT/db7_file_fmt.htm
func Doc ¶
Doc matches a Microsoft Word 97-2003 file. See: https://github.com/decalage2/oletools/blob/412ee36ae45e70f42123e835871bac956d958461/oletools/common/clsid.py
func GeoJSON ¶
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 HAR ¶
HAR matches a HAR Spec file. Spec: http://www.softwareishard.com/blog/har-12-spec/
func InstallShieldCab ¶
InstallShieldCab matches an InstallShield Cabinet archive file.
func Msi ¶
Msi matches a Microsoft Windows Installer file. http://fileformats.archiveteam.org/wiki/Microsoft_Compound_File
func NdJSON ¶
NdJSON matches a Newline delimited JSON file. All complete lines from raw must be valid JSON documents meaning they contain one of the valid JSON data types.
func QuickTime ¶
QuickTime matches a QuickTime File Format file. https://www.loc.gov/preservation/digital/formats/fdd/fdd000052.shtml https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-38190 https://github.com/apache/tika/blob/0f5570691133c75ac4472c3340354a6c4080b104/tika-core/src/main/resources/org/apache/tika/mime/tika-mimetypes.xml#L7758-L7777
func Shp ¶
Shp matches a shape format file. https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf
func Shx ¶
Shx matches a shape index format file. https://www.esri.com/library/whitepapers/pdfs/shapefile.pdf
func Tar ¶
Tar matches a (t)ape (ar)chive file. Tar files are divided into 512 bytes records. First record contains a 257 bytes header padded with NUL.
func Text ¶
Text matches a plain text file.
TODO: This function does not parse BOM-less UTF16 and UTF32 files. Not really sure it should. Linux file utility also requires a BOM for UTF16 and UTF32.
func TzIf ¶
TzIf matches a Time Zone Information Format (TZif) file. See more: https://tools.ietf.org/id/draft-murchison-tzdist-tzif-00.html#rfc.section.3 Its header structure is shown below:
+---------------+---+ | magic (4) | <-+-- version (1) +---------------+---+---------------------------------------+ | [unused - reserved for future use] (15) | +---------------+---------------+---------------+-----------+ | isutccnt (4) | isstdcnt (4) | leapcnt (4) | +---------------+---------------+---------------+ | timecnt (4) | typecnt (4) | charcnt (4) |
func Vtt ¶
Vtt matches a Web Video Text Tracks (WebVTT) file. See https://www.iana.org/assignments/media-types/text/vtt.
Types ¶
type Detector ¶
Detector receiveѕ the raw data of a file and returns whether the data meets any conditions. The limit parameter is an upper limit to the number of bytes received and is used to tell if the byte slice represents the whole file or is just the header of a file: len(raw) < limit or len(raw)>limit.
Notes ¶
Bugs ¶
The "type" key should be searched for in the root object.