Skip to content

Commit 09b6652

Browse files
committed
feat: adding MIME types as codec types
Each MIME type is added as a codec which codec name is prefixed with '/mime/', i.e.: /mime/<mime-type-here> Based on the information at [1] the following ranges are reserved for any mime types/subtypes: Range 0x1000 - 0x17ff: (11 bits) reserved for 'application/*' (there currently are ~1,300 subtypes) Range 0x1800 - 0x18ff: (8 bits) reserved for 'audio/*' (there currently are ~150 subtypes) Range 0x1900 - 0x190f: (4 bits) reserved for 'font/*' (there currently are ~8 subtypes) Range 0x1910 - 0x197f: (7 bits) reserved for 'image/*' (there currently are ~60 subtypes) Range 0x1980 - 0x19cf: (5 bits) reserved for 'message/*' (there currently are ~18 subtypes) Range 0x19d0 - 0x1a3f: (6 bits) reserved for 'model/*' (there currently are ~24 subtypes) Range 0x1a40 - 0x1a8f: (5 bits) reserved for 'multipart/*' (there currently are ~13 subtypes) Range 0x1a90 - 0x1aff: (7 bits) reserved for 'text/*' (there currently are ~71 subtypes) Range 0x1b00 - 0x1b6f: (7 bits) reserved for 'video/*' (there currently are ~78 subtypes) In this PR only the MIME types listed at [2] are declared since these should be the most relevant for the web, plus a few additional ones useful for the semantic web. [1]: https://www.iana.org/assignments/media-types/media-types.xhtml [2]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
1 parent 69e2296 commit 09b6652

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

src/base-table.js

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,3 +414,106 @@ exports['stellar-tx'] = Buffer.from('d1', 'hex')
414414
exports['torrent-info'] = Buffer.from('7b', 'hex')
415415
exports['torrent-file'] = Buffer.from('7c', 'hex')
416416
exports['ed25519-pub'] = Buffer.from('ed', 'hex')
417+
418+
/* MIME Types as codecs:
419+
*
420+
* Based on the information at https://www.iana.org/assignments/media-types/media-types.xhtml
421+
* the following ranges can be reserved for the different mime types/subtypes.
422+
* In this implementation we are only declaring the mime types listed in the following article
423+
* since these should be the most relevant for the web, plus a few more useful for the semantic web:
424+
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types
425+
*/
426+
// Range 0x1000 - 0x17ff (11 bits) reserved for 'application/*' (there currently are ~1,300 subtypes)
427+
exports['mime/application/x-abiword'] = Buffer.from('1000', 'hex')
428+
exports['mime/application/octet-stream'] = Buffer.from('1001', 'hex')
429+
exports['mime/application/vnd.amazon.ebook'] = Buffer.from('1002', 'hex')
430+
exports['mime/application/x-bzip'] = Buffer.from('1003', 'hex')
431+
exports['mime/application/x-bzip2'] = Buffer.from('1004', 'hex')
432+
exports['mime/application/x-csh'] = Buffer.from('1005', 'hex')
433+
exports['mime/application/msword'] = Buffer.from('1006', 'hex')
434+
exports['mime/application/vnd.openxmlformats-officedocument.wordprocessingml.document'] = Buffer.from('1007', 'hex')
435+
exports['mime/application/vnd.ms-fontobject'] = Buffer.from('1008', 'hex')
436+
exports['mime/application/epub+zip'] = Buffer.from('1009', 'hex')
437+
exports['mime/application/ecmascript'] = Buffer.from('100a', 'hex')
438+
exports['mime/application/java-archive'] = Buffer.from('100b', 'hex')
439+
exports['mime/application/javascript'] = Buffer.from('100c', 'hex')
440+
exports['mime/application/json'] = Buffer.from('100d', 'hex')
441+
exports['mime/application/vnd.apple.installer+xml'] = Buffer.from('100e', 'hex')
442+
exports['mime/application/vnd.oasis.opendocument.presentation'] = Buffer.from('100f', 'hex')
443+
exports['mime/application/vnd.oasis.opendocument.spreadsheet'] = Buffer.from('1010', 'hex')
444+
exports['mime/application/vnd.oasis.opendocument.text'] = Buffer.from('1011', 'hex')
445+
exports['mime/application/ogg'] = Buffer.from('1012', 'hex')
446+
exports['mime/application/pdf'] = Buffer.from('1013', 'hex')
447+
exports['mime/application/vnd.ms-powerpoint'] = Buffer.from('1014', 'hex')
448+
exports['mime/application/vnd.openxmlformats-officedocument.presentationml.presentation'] = Buffer.from('1015', 'hex')
449+
exports['mime/application/x-rar-compressed'] = Buffer.from('1016', 'hex')
450+
exports['mime/application/rtf'] = Buffer.from('1017', 'hex')
451+
exports['mime/application/x-sh'] = Buffer.from('1018', 'hex')
452+
exports['mime/application/x-shockwave-flash'] = Buffer.from('1019', 'hex')
453+
exports['mime/application/x-tar'] = Buffer.from('101a', 'hex')
454+
exports['mime/application/typescript'] = Buffer.from('101b', 'hex')
455+
exports['mime/application/vnd.visio'] = Buffer.from('101c', 'hex')
456+
exports['mime/application/xhtml+xml'] = Buffer.from('101d', 'hex')
457+
exports['mime/application/vnd.ms-excel'] = Buffer.from('101e', 'hex')
458+
exports['mime/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] = Buffer.from('101f', 'hex')
459+
exports['mime/application/xml'] = Buffer.from('1020', 'hex')
460+
exports['mime/application/vnd.mozilla.xul+xml'] = Buffer.from('1021', 'hex')
461+
exports['mime/application/zip'] = Buffer.from('1022', 'hex')
462+
exports['mime/application/x-7z-compressed'] = Buffer.from('1023', 'hex')
463+
exports['mime/application/ld+json'] = Buffer.from('1024', 'hex')
464+
exports['mime/application/rdf+xml'] = Buffer.from('1025', 'hex')
465+
466+
// Range 0x1800 - 0x18ff (8 bits) reserved for 'audio/*' (there currently are ~150 subtypes)
467+
exports['mime/audio/aac'] = Buffer.from('1800', 'hex')
468+
exports['mime/audio/midi'] = Buffer.from('1801', 'hex')
469+
exports['mime/audio/x-midi'] = Buffer.from('1802', 'hex')
470+
exports['mime/audio/ogg'] = Buffer.from('1803', 'hex')
471+
exports['mime/audio/wav'] = Buffer.from('1804', 'hex')
472+
exports['mime/audio/webm'] = Buffer.from('1805', 'hex')
473+
exports['mime/audio/3gpp'] = Buffer.from('1806', 'hex')
474+
exports['mime/audio/3gpp2'] = Buffer.from('1807', 'hex')
475+
exports['mime/audio/mp4'] = Buffer.from('1808', 'hex')
476+
477+
// Range 0x1900 - 0x190f (4 bits) reserved for 'font/*' (there currently are ~8 subtypes)
478+
exports['mime/font/otf'] = Buffer.from('1900', 'hex')
479+
exports['mime/font/ttf'] = Buffer.from('1901', 'hex')
480+
exports['mime/font/woff'] = Buffer.from('1902', 'hex')
481+
exports['mime/font/woff2'] = Buffer.from('1903', 'hex')
482+
483+
// Range 0x1910 - 0x197f (7 bits) reserved for 'image/*' (there currently are ~60 subtypes)
484+
exports['mime/image/bmp'] = Buffer.from('1910', 'hex')
485+
exports['mime/image/gif'] = Buffer.from('1911', 'hex')
486+
exports['mime/image/x-icon'] = Buffer.from('1912', 'hex')
487+
exports['mime/image/jpeg'] = Buffer.from('1913', 'hex')
488+
exports['mime/image/png'] = Buffer.from('1914', 'hex')
489+
exports['mime/image/svg+xml'] = Buffer.from('1915', 'hex')
490+
exports['mime/image/tiff'] = Buffer.from('1916', 'hex')
491+
exports['mime/image/webp'] = Buffer.from('1917', 'hex')
492+
493+
// Range 0x1980 - 0x19cf (5 bits) reserved for 'message/*' (there currently are ~18 subtypes)
494+
exports['mime/message/sip'] = Buffer.from('1980', 'hex')
495+
496+
// Range 0x19d0 - 0x1a3f (6 bits) reserved for 'model/*' (there currently are ~24 subtypes)
497+
// exports['mime/model/'] = Buffer.from('19d0', 'hex')
498+
499+
// Range 0x1a40 - 0x1a8f (5 bits) reserved for 'multipart/*' (there currently are ~13 subtypes)
500+
exports['mime/multipart/byteranges'] = Buffer.from('1a40', 'hex')
501+
502+
// Range 0x1a90 - 0x1aff (7 bits) reserved for 'text/*' (there currently are ~71 subtypes)
503+
exports['mime/text/css'] = Buffer.from('1a90', 'hex')
504+
exports['mime/text/csv'] = Buffer.from('1a91', 'hex')
505+
exports['mime/text/html'] = Buffer.from('1a92', 'hex')
506+
exports['mime/text/calendar'] = Buffer.from('1a93', 'hex')
507+
exports['mime/text/plain'] = Buffer.from('1a94', 'hex')
508+
exports['mime/text/turtle'] = Buffer.from('1a95', 'hex')
509+
exports['mime/text/xml'] = Buffer.from('1a96', 'hex')
510+
511+
// Range 0x1b00 - 0x1b6f (7 bits) reserved for 'video/*' (there currently are ~78 subtypes)
512+
exports['mime/video/x-msvideo'] = Buffer.from('1b00', 'hex')
513+
exports['mime/video/mpeg'] = Buffer.from('1b01', 'hex')
514+
exports['mime/video/ogg'] = Buffer.from('1b02', 'hex')
515+
exports['mime/video/webm'] = Buffer.from('1b03', 'hex')
516+
exports['mime/video/3gpp'] = Buffer.from('1b04', 'hex')
517+
exports['mime/video/3gpp2'] = Buffer.from('1b05', 'hex')
518+
exports['mime/video/JPEG'] = Buffer.from('1b06', 'hex')
519+
exports['mime/video/mp4'] = Buffer.from('1b07', 'hex')

0 commit comments

Comments
 (0)