diff --git a/internal/magic/binary.go b/internal/magic/binary.go index 96040e6..0f11015 100644 --- a/internal/magic/binary.go +++ b/internal/magic/binary.go @@ -23,6 +23,8 @@ var ( Torrent = prefix([]byte("d8:announce")) // PAR1 matches a parquet file. Par1 = prefix([]byte{0x50, 0x41, 0x52, 0x31}) + // CBOR matches a Concise Binary Object Representation https://cbor.io/ + CBOR = prefix([]byte{0xD9, 0xD9, 0xF7}) ) // Java bytecode and Mach-O binaries share the same magic number. @@ -156,11 +158,11 @@ func Marc(raw []byte, limit uint32) bool { // 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 | ... | +// <-- 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. // @@ -172,14 +174,15 @@ var Glb = prefix([]byte("\x67\x6C\x54\x46\x02\x00\x00\x00"), // 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) | +// +// +---------------+---+ +// | magic (4) | <-+-- version (1) +// +---------------+---+---------------------------------------+ +// | [unused - reserved for future use] (15) | +// +---------------+---------------+---------------+-----------+ +// | isutccnt (4) | isstdcnt (4) | leapcnt (4) | +// +---------------+---------------+---------------+ +// | timecnt (4) | typecnt (4) | charcnt (4) | func TzIf(raw []byte, limit uint32) bool { // File is at least 44 bytes (header size). if len(raw) < 44 { diff --git a/supported_mimes.md b/supported_mimes.md index 042a5aa..54f043d 100644 --- a/supported_mimes.md +++ b/supported_mimes.md @@ -1,4 +1,4 @@ -## 176 Supported MIME types +## 177 Supported MIME types This file is automatically generated when running tests. Do not edit manually. Extension | MIME type | Aliases @@ -118,6 +118,7 @@ Extension | MIME type | Aliases **.mobi** | application/x-mobipocket-ebook | - **.lit** | application/x-ms-reader | - **.bpg** | image/bpg | - +**.cbor** | application/cbor | - **.sqlite** | application/vnd.sqlite3 | application/x-sqlite3 **.dwg** | image/vnd.dwg | image/x-dwg, application/acad, application/x-acad, application/autocad_dwg, application/dwg, application/x-dwg, application/x-autocad, drawing/dwg **.nes** | application/vnd.nintendo.snes.rom | - diff --git a/tree.go b/tree.go index aa7c8cd..dd5b926 100644 --- a/tree.go +++ b/tree.go @@ -21,7 +21,7 @@ var root = newMIME("application/octet-stream", "", jpm, jxs, gif, webp, exe, elf, ar, tar, xar, bz2, fits, tiff, bmp, ico, mp3, flac, midi, ape, musePack, amr, wav, aiff, au, mpeg, quickTime, mp4, webM, avi, flv, mkv, asf, aac, voc, m3u, rmvb, gzip, class, swf, crx, ttf, woff, - woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar, djvu, mobi, lit, bpg, + woff2, otf, ttc, eot, wasm, shx, dbf, dcm, rar, djvu, mobi, lit, bpg, cbor, sqlite3, dwg, nes, lnk, macho, qcp, icns, hdr, mrc, mdb, accdb, zstd, cab, rpm, xz, lzip, torrent, cpio, tzif, xcf, pat, gbr, glb, cabIS, jxr, parquet, // Keep text last because it is the slowest check. @@ -261,4 +261,5 @@ var ( jxr = newMIME("image/jxr", ".jxr", magic.Jxr).alias("image/vnd.ms-photo") parquet = newMIME("application/vnd.apache.parquet", ".parquet", magic.Par1). alias("application/x-parquet") + cbor = newMIME("application/cbor", ".cbor", magic.CBOR) )