Browse Source

new built-in MIME types and improvements enabling alternate db

master
boB Rudis 5 years ago
parent
commit
b5722828d2
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 2
      .Rbuildignore
  2. 11
      DESCRIPTION
  3. 1
      NAMESPACE
  4. 830
      R/aaa.r
  5. 16
      R/get-content-type.R
  6. 48
      R/guess-content-type.R
  7. BIN
      R/sysdata.rda
  8. 11
      README.Rmd
  9. 23
      README.md
  10. 87
      inst/tinytest/test_wand.R
  11. 14
      man/get_content_type.Rd
  12. 19
      man/guess_content_type.Rd
  13. 15
      man/simplemagic_mime_db.Rd
  14. 31
      tools/build-ext-db.R
  15. 1764
      tools/orig-db.csv

2
.Rbuildignore

@ -11,3 +11,5 @@
^builder$
^\.vscode$
^CRAN-RELEASE$
^appveyor\.yml$
^tools$

11
DESCRIPTION

@ -1,19 +1,18 @@
Package: wand
Type: Package
Title: Retrieve 'Magic' Attributes from Files and
Title: Retrieve Magic Attributes from Files and
Directories
Version: 0.5.0
Date: 2019-07-06
Version: 0.6.0
Date: 2019-07-27
Authors@R: c( person("Bob", "Rudis", email =
"bob@rud.is", role = c("aut", "cre"), comment =
c(ORCID = "0000-0001-5670-2640")) )
Maintainer: Bob Rudis <bob@rud.is>
Description: 'MIME' types are shorthand descriptors for
Description: MIME types are shorthand descriptors for
file contents and can be determined from "magic"
bytes in file headers, file contents or intuited
from file extensions. Tools are provided to
perform curated "magic" tests as well as mapping
'MIME' types from a database of over 1,500
MIME types from a database of over 1,800
extension mappings.
URL: http://gitlab.com/hrbrmstr/wand
BugReports: https://gitlab.com/hrbrmstr/wand/issues

1
NAMESPACE

@ -2,5 +2,4 @@
export(get_content_type)
export(guess_content_type)
export(simplemagic_mime_db)
importFrom(tools,file_ext)

830
R/aaa.r

@ -1,820 +1,12 @@
#' File extension-to-MIME mapping data frame
#'
#' @name simplemagic_mime_db
#' @title File extension-to-MIME mapping data frame
#' @description built from the files found in the References
#' @docType data
#' @export
structure(list(extension = c("pyc", "dwg", "ez", "aw", "arj",
"atom", "xml", "atomcat", "atomsvc", "mm", "mme", "hqx", "hqx",
"boo", "book", "ccxml", "cdf", "cdmia", "cdmic", "cdmid", "cdmio",
"cdmiq", "ccad", "dp", "cu", "csm", "davmount", "dbk", "drw",
"tsp", "dssc", "xdssc", "dxf", "es", "ecma", "js", "emma", "evy",
"epub", "xl", "xla", "xlb", "xlc", "xld", "xlk", "xll", "xlm",
"xls", "xlt", "xlv", "xlw", "exi", "pfr", "woff", "fif", "frl",
"spl", "gml", "tgz", "gpx", "vew", "gxf", "hlp", "hta", "stk",
"unv", "iges", "igs", "inf", "ink", "inkml", "acx", "ipfix",
"class", "jar", "class", "ser", "class", "js", "json", "jsonml",
"lha", "lostxml", "lzx", "bin", "hqx", "hqx", "cpt", "bin", "mads",
"mrc", "mrcx", "ma", "nb", "mb", "mathml", "mbd", "mbox", "mcd",
"mscml", "metalink", "meta4", "mets", "aps", "mods", "m21", "mp21",
"mp4", "m4p", "mp4s", "mdb", "one", "onetoc2", "onetmp", "onepkg",
"pot", "pps", "ppt", "ppz", "doc", "dot", "w6w", "wiz", "word",
"wri", "mxf", "mcp", "bin", "dms", "lrf", "mar", "so", "dist",
"distz", "pkg", "bpk", "dump", "elc", "a", "arc", "arj", "com",
"exe", "lha", "lhx", "lzh", "lzx", "o", "psd", "saveme", "uu",
"zoo", "class", "buffer", "deploy", "hqx", "obj", "lib", "zip",
"gz", "dmg", "iso", "oda", "opf", "ogx", "ogg", "axs", "omdoc",
"onetoc", "onetoc2", "onetmp", "onepkg", "oxps", "xer", "pdf",
"pgp", "key", "asc", "pgp", "sig", "prf", "p12", "crl", "p10",
"p7m", "p7c", "p7s", "p8", "ac", "cer", "crt", "crl", "pkipath",
"pki", "text", "pls", "ai", "eps", "ps", "ppt", "part", "prt",
"cww", "pskcxml", "rar", "rdf", "rif", "rnc", "rl", "rld", "rng",
"rs", "gbr", "mft", "roa", "rsd", "rss", "xml", "rtf", "rtx",
"sbml", "scq", "scs", "spq", "spp", "sdp", "sea", "set", "setpay",
"setreg", "shf", "stl", "smi", "smil", "smi", "smil", "sol",
"sdr", "rq", "srx", "gram", "grxml", "sru", "ssdl", "ssml", "step",
"stp", "ssm", "tei", "teicorpus", "tfi", "tsd", "tbk", "vda",
"plb", "psb", "pvb", "tcap", "pwn", "aso", "imp", "acu", "atc",
"acutc", "air", "fcdt", "fxp", "fxpl", "xdp", "xfdf", "ahead",
"azf", "azs", "azw", "acc", "ami", "apk", "cii", "fti", "atx",
"mpkg", "m3u8", "swi", "swi", "iota", "aep", "mpm", "bmi", "rep",
"cdxml", "mmd", "cdy", "cla", "rp9", "c4g", "c4d", "c4f", "c4p",
"c4u", "c11amc", "c11amz", "csp", "cdbcmsg", "cmc", "clkx", "clkk",
"clkp", "clkt", "clkw", "wbs", "pml", "ppd", "car", "pcurl",
"dart", "rdz", "uvf", "uvvf", "uvd", "uvvd", "uvt", "uvvt", "uvx",
"uvvx", "uvz", "uvvz", "fe_launch", "dna", "mlp", "dpg", "dfac",
"kpxx", "ait", "svc", "geo", "mag", "nml", "esf", "msf", "qam",
"slt", "ssf", "es3", "et3", "ez2", "ez3", "fdf", "mseed", "seed",
"dataless", "gph", "ftc", "fm", "frame", "maker", "book", "fnc",
"ltf", "fsc", "oas", "oa2", "oa3", "fg5", "bh2", "ddd", "xdw",
"xbd", "fzs", "txd", "ggb", "ggt", "gex", "gre", "gxt", "g2w",
"g3w", "gmx", "kml", "kmz", "gqf", "gqs", "gac", "ghf", "gim",
"grv", "gtm", "tpl", "vcg", "hal", "zmm", "hbci", "les", "hgl",
"hpg", "hpgl", "hpid", "hps", "jlt", "pcl", "pclxl", "sfd-hdstx",
"x3d", "mpy", "afp", "listafp", "list3820", "irm", "sc", "icc",
"icm", "igl", "ivp", "ivu", "igm", "xpw", "xpx", "i2g", "qbo",
"qfx", "rcprofile", "irp", "xpr", "fcs", "jam", "rms", "jisp",
"joda", "ktz", "ktr", "karbon", "chrt", "kfo", "flw", "kon",
"kpr", "kpt", "ksp", "kwd", "kwt", "htke", "kia", "kne", "knp",
"skp", "skd", "skt", "skm", "sse", "lasxml", "lbd", "lbe", "123",
"apr", "pre", "nsf", "org", "scm", "lwp", "portpkg", "mcd", "mc1",
"cdkey", "mwf", "mfm", "flo", "igx", "mif", "daf", "dis", "mbk",
"mqy", "msl", "plc", "txf", "mpn", "mpc", "xul", "cil", "cab",
"xls", "xlm", "xla", "xlc", "xlt", "xlb", "xll", "xlw", "xlam",
"xlam", "xlsb", "xlsb", "xlsm", "xlsm", "xltm", "xltm", "eot",
"chm", "ims", "lrm", "thmx", "msg", "sst", "pko", "cat", "stl",
"sst", "cat", "stl", "ppt", "pps", "pot", "ppa", "pwz", "ppam",
"ppam", "pptm", "potm", "pptm", "potm", "sldm", "sldm", "ppsm",
"ppsm", "potm", "potm", "mpp", "mpt", "docm", "docm", "dotm",
"dotm", "wps", "wks", "wcm", "wdb", "wpl", "xps", "mseq", "mus",
"msty", "taglet", "nlu", "ntf", "nitf", "nnd", "nns", "nnw",
"ncm", "ngdat", "n-gage", "rpst", "rpss", "rng", "edm", "edx",
"ext", "edm", "edx", "ext", "odc", "otc", "odb", "odf", "odft",
"odg", "otg", "odi", "oti", "odp", "otp", "ods", "ots", "odt",
"odm", "otm", "ott", "oth", "xo", "dd2", "oxt", "pptx", "sldx",
"ppsx", "potx", "xlsx", "xltx", "docx", "dotx", "mgp", "dp",
"esa", "pdb", "pqa", "oprc", "paw", "str", "ei6", "efif", "wg",
"plf", "pbd", "box", "mgz", "qps", "ptid", "qxd", "qxt", "qwd",
"qwt", "qxl", "qxb", "bed", "mxl", "musicxml", "cryptonote",
"cod", "rm", "rmvb", "rnx", "link66", "st", "see", "sema", "semd",
"semf", "ifm", "itp", "iif", "ipk", "twd", "twds", "mmf", "teacher",
"sdkm", "sdkd", "dxp", "sfs", "sdc", "sda", "sdd", "sdp", "smf",
"sdw", "vor", "sgl", "smzip", "sm", "sxc", "stc", "sxd", "std",
"sxi", "sti", "sxm", "sxw", "sxg", "stw", "sus", "susp", "svd",
"sis", "sisx", "xsm", "bdm", "xdm", "tao", "pcap", "cap", "dmp",
"tmo", "tpt", "mxs", "tra", "ufd", "ufdl", "utz", "umj", "unityweb",
"uoml", "vcx", "vsd", "vst", "vss", "vsw", "vis", "vsf", "sic",
"slc", "wbxml", "wmlc", "wmlsc", "wtb", "nbp", "wpd", "wqd",
"stf", "xar", "web", "xfdl", "hvd", "hvs", "hvp", "osf", "osfpvg",
"saf", "spf", "cmp", "zir", "zirz", "zaz", "vmd", "vmf", "vxml",
"wgt", "hlp", "wp", "wp5", "wp6", "wpd", "wp5", "w60", "wp5",
"w61", "wsdl", "wspolicy", "wk1", "wk", "7z", "abw", "ace", "aim",
"dmg", "aab", "x32", "u32", "vox", "aam", "aas", "bcpio", "bin",
"hqx", "torrent", "blb", "blorb", "bsh", "sh", "shar", "elc",
"elc", "bz", "bz2", "boz", "cbr", "cba", "cbt", "cbz", "cb7",
"cdf", "vcd", "cfs", "chat", "cha", "pgn", "chm", "crx", "ras",
"cco", "cpt", "z", "gz", "tgz", "z", "zip", "nsc", "cpio", "cpt",
"csh", "deb", "udeb", "deepv", "dgc", "dir", "dcr", "dxr", "cst",
"cct", "cxt", "w3d", "fgd", "swa", "dms", "wad", "ncx", "dtb",
"res", "dvi", "elc", "env", "evy", "es", "eva", "xla", "xlb",
"xlc", "xld", "xlk", "xll", "xlm", "xls", "xlt", "xlv", "xlw",
"flac", "pfa", "pfb", "gsf", "pcf", "pcf.Z", "bdf", "gsf", "psf",
"otf", "pcf", "snf", "ttf", "ttc", "pfa", "pfb", "pfm", "afm",
"woff", "mif", "arc", "pre", "spl", "gca", "ulx", "gnumeric",
"sgf", "gramps", "gcf", "gsp", "gss", "gtar", "tgz", "taz", "gz",
"gzip", "tgz", "hdf", "help", "hlp", "imap", "phtml", "pht",
"php", "phps", "php3", "php3p", "php4", "ica", "ima", "install",
"ins", "isp", "ins", "iv", "ip", "iii", "iso", "jar", "class",
"jcm", "jnlp", "ser", "class", "js", "chrt", "kil", "skd", "skm",
"skp", "skt", "kpr", "kpt", "ksh", "ksp", "kwd", "kwt", "latex",
"ltx", "lha", "lsp", "ivy", "wq1", "scm", "luac", "lzh", "lzh",
"lha", "lzx", "hqx", "bin", "mc$", "frm", "maker", "frame", "fm",
"fb", "book", "fbdoc", "mcd", "mm", "mid", "midi", "mie", "mif",
"nix", "prc", "mobi", "m3u8", "asx", "application", "lnk", "wmd",
"wmz", "xbap", "mdb", "obd", "crd", "clp", "com", "exe", "bat",
"dll", "exe", "dll", "com", "bat", "msi", "xla", "xls", "xlw",
"msi", "mvb", "m13", "m14", "wmf", "wmz", "emf", "emz", "mny",
"ppt", "pub", "scd", "trm", "wri", "ani", "nvd", "map", "stl",
"nc", "cdf", "pkg", "aos", "pac", "nwc", "nzb", "o", "omc", "omcd",
"omcr", "oza", "pm4", "pm5", "pcl", "pma", "pmc", "pml", "pmr",
"pmw", "plx", "p10", "p12", "pfx", "p7b", "spc", "p7r", "crl",
"p7c", "p7m", "p7a", "p7s", "css", "pnm", "mpc", "mpt", "mpv",
"mpx", "pyc", "pyo", "wb1", "qtl", "rar", "rpm", "ris", "rpm",
"rtf", "sdp", "sea", "sl", "sh", "shar", "sh", "swf", "swfl",
"xap", "sit", "spr", "sprite", "sql", "sit", "sitx", "srt", "sv4cpio",
"sv4crc", "t3", "gam", "tar", "sbk", "tbk", "tcl", "tex", "gf",
"pk", "tfm", "texinfo", "texi", "obj", "~", "%", "bak", "old",
"sik", "roff", "t", "tr", "man", "me", "ms", "avi", "ustar",
"vsd", "vst", "vsw", "mzz", "xpix", "vrml", "src", "wsrc", "webapp",
"wz", "hlp", "wtk", "svr", "wrl", "wpd", "wri", "der", "cer",
"crt", "crt", "xcf", "fig", "xlf", "xpi", "xz", "zip", "z1",
"z2", "z3", "z4", "z5", "z6", "z7", "z8", "xaml", "xdf", "xenc",
"xhtml", "xht", "xml", "xsl", "xpdl", "dtd", "xop", "xpl", "xslt",
"xspf", "mxml", "xhvml", "xvml", "xvm", "yang", "yin", "pko",
"zip", "adp", "aif", "aifc", "aiff", "au", "snd", "flac", "it",
"funk", "my", "pfunk", "pfunk", "rmi", "mid", "mid", "midi",
"kar", "rmi", "mod", "mp4a", "m4a", "mpga", "mp2", "mp2a", "mp3",
"m2a", "mpa", "mpg", "m3a", "mpega", "m4a", "mp3", "m3u", "la",
"lma", "oga", "ogg", "spx", "sid", "s3m", "sil", "tsi", "tsp",
"uva", "uvva", "eol", "dra", "dts", "dtshd", "lvp", "pya", "ecelp4800",
"ecelp7470", "ecelp9600", "qcp", "rip", "voc", "vox", "wav",
"weba", "aac", "snd", "aif", "aiff", "aifc", "au", "caf", "flac",
"gsd", "gsm", "jam", "lam", "mka", "mid", "midi", "mid", "midi",
"mod", "mp2", "mp3", "m3u", "m3u", "wax", "wma", "la", "lma",
"ram", "ra", "rm", "rmm", "rmp", "rmp", "ra", "rpm", "sid", "ra",
"pls", "sd2", "vqf", "vqe", "vql", "mjf", "voc", "wav", "xm",
"cdx", "cif", "cmdf", "cml", "csml", "pdb", "xyz", "xyz", "dwf",
"dwf", "otf", "ivr", "bmp", "bm", "cgm", "cod", "ras", "rast",
"fif", "flo", "turbot", "g3", "gif", "ief", "iefs", "jpeg", "jpg",
"jfif", "jfif-tbnl", "jpe", "jut", "ktx", "nap", "naplps", "pcx",
"pic", "pict", "jfif", "jfif", "jpe", "jpeg", "jpg", "png", "x-png",
"btif", "sgi", "svg", "svgz", "tiff", "tif", "mcf", "psd", "uvi",
"uvvi", "uvg", "uvvg", "djvu", "djv", "sub", "dwg", "dxf", "svf",
"dxf", "fbs", "fpx", "fpix", "fst", "mmr", "rlc", "mdi", "wdp",
"npx", "fpx", "rf", "rp", "wbmp", "xif", "webp", "3ds", "ras",
"ras", "cmx", "cdr", "pat", "cdt", "cpt", "dwg", "dxf", "svf",
"fh", "fhc", "fh4", "fh5", "fh7", "ico", "art", "jng", "jps",
"sid", "bmp", "nif", "niff", "pcx", "psd", "pic", "pct", "pnm",
"pbm", "pgm", "pgm", "ppm", "qif", "qti", "qtif", "rgb", "tga",
"tif", "tiff", "bmp", "xbm", "xpm", "xbm", "xpm", "pm", "xwd",
"xwd", "xbm", "xpm", "eml", "mht", "mhtml", "mime", "nws", "igs",
"iges", "msh", "mesh", "silo", "dae", "dwf", "gdl", "gtw", "mts",
"vtu", "wrl", "vrml", "wrz", "pov", "x3db", "x3dbz", "x3dv",
"x3dvz", "x3d", "x3dz", "gzip", "ustar", "zip", "mid", "midi",
"kar", "pvu", "asp", "appcache", "manifest", "ics", "ifb", "icz",
"csv", "css", "csv", "js", "event-stream", "323", "html", "acgi",
"htm", "htmls", "htx", "shtml", "stm", "uls", "js", "mml", "mcf",
"n3", "pas", "txt", "text", "conf", "def", "list", "log", "c",
"c++", "cc", "com", "cxx", "f", "f90", "for", "g", "h", "hh",
"idc", "jav", "java", "lst", "m", "mar", "pl", "sdml", "bas",
"in", "asc", "diff", "pot", "el", "ksh", "par", "dsc", "rtx",
"rt", "rtf", "rtf", "wsc", "sct", "wsc", "sgml", "sgm", "tsv",
"tm", "ts", "t", "tr", "roff", "man", "me", "ms", "ttl", "uri",
"uris", "uni", "unis", "urls", "vcard", "abc", "curl", "dcurl",
"mcurl", "scurl", "sub", "fly", "flx", "gv", "3dml", "spot",
"rt", "jad", "si", "sl", "wml", "wmls", "vtt", "htt", "s", "asm",
"aip", "c", "cc", "cxx", "cpp", "h", "hh", "dic", "h++", "hpp",
"hxx", "hh", "c++", "cpp", "cxx", "cc", "h", "htc", "csh", "c",
"f", "for", "f77", "f90", "h", "hh", "java", "java", "jav", "lsx",
"lua", "m", "markdown", "md", "mkd", "moc", "nfo", "opml", "p",
"pas", "gcd", "pl", "pm", "py", "hlb", "csh", "el", "scm", "ksh",
"lsp", "pl", "pm", "py", "rexx", "scm", "sh", "tcl", "tcsh",
"zsh", "shtml", "ssi", "etx", "sfv", "sgm", "sgml", "sh", "spc",
"talk", "tcl", "tk", "tex", "ltx", "sty", "cls", "uil", "uu",
"uue", "vcs", "vcf", "xml", "3gp", "3g2", "ts", "afl", "avi",
"avs", "dl", "flc", "fli", "flc", "fli", "gl", "h261", "h263",
"h264", "jpgv", "jpm", "jpgm", "mj2", "mjp2", "mp4", "mp4v",
"mpg4", "mpeg", "mpg", "mpe", "m1v", "m2v", "mp2", "mp3", "mpa",
"mpv2", "avi", "ogv", "qt", "moov", "mov", "vdo", "viv", "vivo",
"uvh", "uvvh", "uvm", "uvvm", "uvp", "uvvp", "uvs", "uvvs", "uvv",
"uvvv", "dvb", "fvt", "mxu", "m4u", "pyv", "rv", "uvu", "uvvu",
"viv", "vivo", "vos", "webm", "xdr", "xsr", "fmf", "dl", "dif",
"dv", "f4v", "fli", "flv", "gl", "isu", "lsf", "lsx", "m4v",
"mkv", "mk3d", "mks", "mng", "mjpg", "mp2", "mp3", "mp2", "asf",
"asx", "asr", "asx", "vob", "wm", "wmv", "wmx", "wvx", "avi",
"qtc", "scm", "movie", "mv", "smv", "wmf", "mime", "ice", "mid",
"midi", "3dm", "3dmf", "qd3", "qd3d", "svr", "vrml", "wrl", "wrz",
"flr", "xaf", "xof", "vrm", "vrt", "xgz", "xmz", "ma nb mb",
"doc dot", "bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy",
"onetoc onetoc2 onetmp onepkg", "asc sig", "p7m p7c", "ai eps ps",
"smi smil", "atc acutc", "c4g c4d c4f c4p c4u", "es3 et3", "seed dataless",
"fm frame maker book", "gex gre", "gqf gqs", "afp listafp list3820",
"icc icm", "xpw xpx", "ktz ktr", "kpr kpt", "kwd kwt", "kne knp",
"skp skd skt skm", "xls xlm xla xlc xlt xlw", "ppt pps pot",
"mpp mpt", "wps wks wcm wdb", "pdb pqa oprc", "qxd qxt qwd qwt qxl qxb",
"twd twds", "sdkm sdkd", "sus susp", "sis sisx", "ufd ufdl",
"vsd vst vss vsw", "zir zirz", "aab x32 u32 vox", "bz2 boz",
"deb udeb", "dir dcr dxr cst cct cxt w3d fgd swa", "ttf ttc",
"pfa pfb pfm afm", "prc mobi", "exe dll com bat msi", "mvb m13 m14",
"nc cdf", "p12 pfx", "p7b spc", "texinfo texi", "der crt", "xhtml xht",
"xml xsl", "mxml xhvml xvml xvm", "au snd", "mid midi kar rmi",
"mpga mp2 mp2a mp3 m2a m3a", "oga ogg spx", "aif aiff aifc",
"ram ra", "jpeg jpg jpe", "svg svgz", "tiff tif", "djvu djv",
"fh fhc fh4 fh5 fh7", "pic pct", "eml mime", "igs iges", "msh mesh silo",
"wrl vrml", "ics ifb", "html htm", "txt text conf def list log in",
"sgml sgm", "t tr roff man me ms", "uri uris urls", "s asm",
"c cc cxx cpp h hh dic", "f for f77 f90", "p pas", "jpm jpgm",
"mj2 mjp2", "mp4 mp4v mpg4", "mpeg mpg mpe m1v m2v", "qt mov",
"mxu m4u", "asf asx"), mime_type = c("application/x-bytecode.python",
"application/acad", "application/andrew-inset", "application/applixware",
"application/arj", "application/atom+xml", "application/atom+xml",
"application/atomcat+xml", "application/atomsvc+xml", "application/base64",
"application/base64", "application/binhex", "application/binhex4",
"application/book", "application/book", "application/ccxml+xml",
"application/cdf", "application/cdmi-capability", "application/cdmi-container",
"application/cdmi-domain", "application/cdmi-object", "application/cdmi-queue",
"application/clariscad", "application/commonground", "application/cu-seeme",
"application/cu-seeme", "application/davmount+xml", "application/docbook+xml",
"application/drafting", "application/dsptype", "application/dssc+der",
"application/dssc+xml", "application/dxf", "application/ecmascript",
"application/ecmascript", "application/ecmascript", "application/emma+xml",
"application/envoy", "application/epub+zip", "application/excel",
"application/excel", "application/excel", "application/excel",
"application/excel", "application/excel", "application/excel",
"application/excel", "application/excel", "application/excel",
"application/excel", "application/excel", "application/exi",
"application/font-tdpfr", "application/font-woff", "application/fractals",
"application/freeloader", "application/futuresplash", "application/gml+xml",
"application/gnutar", "application/gpx+xml", "application/groupwise",
"application/gxf", "application/hlp", "application/hta", "application/hyperstudio",
"application/i-deas", "application/iges", "application/iges",
"application/inf", "application/inkml+xml", "application/inkml+xml",
"application/internet-property-stream", "application/ipfix",
"application/java", "application/java-archive", "application/java-byte-code",
"application/java-serialized-object", "application/java-vm",
"application/javascript", "application/json", "application/jsonml+json",
"application/lha", "application/lost+xml", "application/lzx",
"application/mac-binary", "application/mac-binhex", "application/mac-binhex40",
"application/mac-compactpro", "application/macbinary", "application/mads+xml",
"application/marc", "application/marcxml+xml", "application/mathematica",
"application/mathematica", "application/mathematica", "application/mathml+xml",
"application/mbedlet", "application/mbox", "application/mcad",
"application/mediaservercontrol+xml", "application/metalink+xml",
"application/metalink4+xml", "application/mets+xml", "application/mime",
"application/mods+xml", "application/mp21", "application/mp21",
"application/mp4", "application/mp4", "application/mp4", "application/msaccess",
"application/msonenote", "application/msonenote", "application/msonenote",
"application/msonenote", "application/mspowerpoint", "application/mspowerpoint",
"application/mspowerpoint", "application/mspowerpoint", "application/msword",
"application/msword", "application/msword", "application/msword",
"application/msword", "application/mswrite", "application/mxf",
"application/netmc", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/octet-stream", "application/octet-stream", "application/octet-stream",
"application/oda", "application/oebps-package+xml", "application/ogg",
"application/ogg", "application/olescript", "application/omdoc+xml",
"application/onenote", "application/onenote", "application/onenote",
"application/onenote", "application/oxps", "application/patch-ops-error+xml",
"application/pdf", "application/pgp-encrypted", "application/pgp-keys",
"application/pgp-signature", "application/pgp-signature", "application/pgp-signature",
"application/pics-rules", "application/pkcs-12", "application/pkcs-crl",
"application/pkcs10", "application/pkcs7-mime", "application/pkcs7-mime",
"application/pkcs7-signature", "application/pkcs8", "application/pkix-attr-cert",
"application/pkix-cert", "application/pkix-cert", "application/pkix-crl",
"application/pkix-pkipath", "application/pkixcmp", "application/plain",
"application/pls+xml", "application/postscript", "application/postscript",
"application/postscript", "application/powerpoint", "application/pro_eng",
"application/pro_eng", "application/prs.cww", "application/pskc+xml",
"application/rar", "application/rdf+xml", "application/reginfo+xml",
"application/relax-ng-compact-syntax", "application/resource-lists+xml",
"application/resource-lists-diff+xml", "application/ringing-tones",
"application/rls-services+xml", "application/rpki-ghostbusters",
"application/rpki-manifest", "application/rpki-roa", "application/rsd+xml",
"application/rss+xml", "application/rss+xml", "application/rtf",
"application/rtf", "application/sbml+xml", "application/scvp-cv-request",
"application/scvp-cv-response", "application/scvp-vp-request",
"application/scvp-vp-response", "application/sdp", "application/sea",
"application/set", "application/set-payment-initiation", "application/set-registration-initiation",
"application/shf+xml", "application/sla", "application/smil",
"application/smil", "application/smil+xml", "application/smil+xml",
"application/solids", "application/sounder", "application/sparql-query",
"application/sparql-results+xml", "application/srgs", "application/srgs+xml",
"application/sru+xml", "application/ssdl+xml", "application/ssml+xml",
"application/step", "application/step", "application/streamingmedia",
"application/tei+xml", "application/tei+xml", "application/thraud+xml",
"application/timestamped-data", "application/toolbook", "application/vda",
"application/vnd.3gpp.pic-bw-large", "application/vnd.3gpp.pic-bw-small",
"application/vnd.3gpp.pic-bw-var", "application/vnd.3gpp2.tcap",
"application/vnd.3m.post-it-notes", "application/vnd.accpac.simply.aso",
"application/vnd.accpac.simply.imp", "application/vnd.acucobol",
"application/vnd.acucorp", "application/vnd.acucorp", "application/vnd.adobe.air-application-installer-package+zip",
"application/vnd.adobe.formscentral.fcdt", "application/vnd.adobe.fxp",
"application/vnd.adobe.fxp", "application/vnd.adobe.xdp+xml",
"application/vnd.adobe.xfdf", "application/vnd.ahead.space",
"application/vnd.airzip.filesecure.azf", "application/vnd.airzip.filesecure.azs",
"application/vnd.amazon.ebook", "application/vnd.americandynamics.acc",
"application/vnd.amiga.ami", "application/vnd.android.package-archive",
"application/vnd.anser-web-certificate-issue-initiation", "application/vnd.anser-web-funds-transfer-initiation",
"application/vnd.antix.game-component", "application/vnd.apple.installer+xml",
"application/vnd.apple.mpegurl", "application/vnd.arastra.swi",
"application/vnd.aristanetworks.swi", "application/vnd.astraea-software.iota",
"application/vnd.audiograph", "application/vnd.blueice.multipass",
"application/vnd.bmi", "application/vnd.businessobjects", "application/vnd.chemdraw+xml",
"application/vnd.chipnuts.karaoke-mmd", "application/vnd.cinderella",
"application/vnd.claymore", "application/vnd.cloanto.rp9", "application/vnd.clonk.c4group",
"application/vnd.clonk.c4group", "application/vnd.clonk.c4group",
"application/vnd.clonk.c4group", "application/vnd.clonk.c4group",
"application/vnd.cluetrust.cartomobile-config", "application/vnd.cluetrust.cartomobile-config-pkg",
"application/vnd.commonspace", "application/vnd.contact.cmsg",
"application/vnd.cosmocaller", "application/vnd.crick.clicker",
"application/vnd.crick.clicker.keyboard", "application/vnd.crick.clicker.palette",
"application/vnd.crick.clicker.template", "application/vnd.crick.clicker.wordbank",
"application/vnd.criticaltools.wbs+xml", "application/vnd.ctc-posml",
"application/vnd.cups-ppd", "application/vnd.curl.car", "application/vnd.curl.pcurl",
"application/vnd.dart", "application/vnd.data-vision.rdz", "application/vnd.dece.data",
"application/vnd.dece.data", "application/vnd.dece.data", "application/vnd.dece.data",
"application/vnd.dece.ttml+xml", "application/vnd.dece.ttml+xml",
"application/vnd.dece.unspecified", "application/vnd.dece.unspecified",
"application/vnd.dece.zip", "application/vnd.dece.zip", "application/vnd.denovo.fcselayout-link",
"application/vnd.dna", "application/vnd.dolby.mlp", "application/vnd.dpgraph",
"application/vnd.dreamfactory", "application/vnd.ds-keypoint",
"application/vnd.dvb.ait", "application/vnd.dvb.service", "application/vnd.dynageo",
"application/vnd.ecowin.chart", "application/vnd.enliven", "application/vnd.epson.esf",
"application/vnd.epson.msf", "application/vnd.epson.quickanime",
"application/vnd.epson.salt", "application/vnd.epson.ssf", "application/vnd.eszigno3+xml",
"application/vnd.eszigno3+xml", "application/vnd.ezpix-album",
"application/vnd.ezpix-package", "application/vnd.fdf", "application/vnd.fdsn.mseed",
"application/vnd.fdsn.seed", "application/vnd.fdsn.seed", "application/vnd.flographit",
"application/vnd.fluxtime.clip", "application/vnd.framemaker",
"application/vnd.framemaker", "application/vnd.framemaker", "application/vnd.framemaker",
"application/vnd.frogans.fnc", "application/vnd.frogans.ltf",
"application/vnd.fsc.weblaunch", "application/vnd.fujitsu.oasys",
"application/vnd.fujitsu.oasys2", "application/vnd.fujitsu.oasys3",
"application/vnd.fujitsu.oasysgp", "application/vnd.fujitsu.oasysprs",
"application/vnd.fujixerox.ddd", "application/vnd.fujixerox.docuworks",
"application/vnd.fujixerox.docuworks.binder", "application/vnd.fuzzysheet",
"application/vnd.genomatix.tuxedo", "application/vnd.geogebra.file",
"application/vnd.geogebra.tool", "application/vnd.geometry-explorer",
"application/vnd.geometry-explorer", "application/vnd.geonext",
"application/vnd.geoplan", "application/vnd.geospace", "application/vnd.gmx",
"application/vnd.google-earth.kml+xml", "application/vnd.google-earth.kmz",
"application/vnd.grafeq", "application/vnd.grafeq", "application/vnd.groove-account",
"application/vnd.groove-help", "application/vnd.groove-identity-message",
"application/vnd.groove-injector", "application/vnd.groove-tool-message",
"application/vnd.groove-tool-template", "application/vnd.groove-vcard",
"application/vnd.hal+xml", "application/vnd.handheld-entertainment+xml",
"application/vnd.hbci", "application/vnd.hhe.lesson-player",
"application/vnd.hp-hpgl", "application/vnd.hp-hpgl", "application/vnd.hp-hpgl",
"application/vnd.hp-hpid", "application/vnd.hp-hps", "application/vnd.hp-jlyt",
"application/vnd.hp-pcl", "application/vnd.hp-pclxl", "application/vnd.hydrostatix.sof-data",
"application/vnd.hzn-3d-crossword", "application/vnd.ibm.minipay",
"application/vnd.ibm.modcap", "application/vnd.ibm.modcap", "application/vnd.ibm.modcap",
"application/vnd.ibm.rights-management", "application/vnd.ibm.secure-container",
"application/vnd.iccprofile", "application/vnd.iccprofile", "application/vnd.igloader",
"application/vnd.immervision-ivp", "application/vnd.immervision-ivu",
"application/vnd.insors.igm", "application/vnd.intercon.formnet",
"application/vnd.intercon.formnet", "application/vnd.intergeo",
"application/vnd.intu.qbo", "application/vnd.intu.qfx", "application/vnd.ipunplugged.rcprofile",
"application/vnd.irepository.package+xml", "application/vnd.is-xpr",
"application/vnd.isac.fcs", "application/vnd.jam", "application/vnd.jcp.javame.midlet-rms",
"application/vnd.jisp", "application/vnd.joost.joda-archive",
"application/vnd.kahootz", "application/vnd.kahootz", "application/vnd.kde.karbon",
"application/vnd.kde.kchart", "application/vnd.kde.kformula",
"application/vnd.kde.kivio", "application/vnd.kde.kontour", "application/vnd.kde.kpresenter",
"application/vnd.kde.kpresenter", "application/vnd.kde.kspread",
"application/vnd.kde.kword", "application/vnd.kde.kword", "application/vnd.kenameaapp",
"application/vnd.kidspiration", "application/vnd.kinar", "application/vnd.kinar",
"application/vnd.koan", "application/vnd.koan", "application/vnd.koan",
"application/vnd.koan", "application/vnd.kodak-descriptor", "application/vnd.las.las+xml",
"application/vnd.llamagraphics.life-balance.desktop", "application/vnd.llamagraphics.life-balance.exchange+xml",
"application/vnd.lotus-1-2-3", "application/vnd.lotus-approach",
"application/vnd.lotus-freelance", "application/vnd.lotus-notes",
"application/vnd.lotus-organizer", "application/vnd.lotus-screencam",
"application/vnd.lotus-wordpro", "application/vnd.macports.portpkg",
"application/vnd.mcd", "application/vnd.medcalcdata", "application/vnd.mediastation.cdkey",
"application/vnd.mfer", "application/vnd.mfmp", "application/vnd.micrografx.flo",
"application/vnd.micrografx.igx", "application/vnd.mif", "application/vnd.mobius.daf",
"application/vnd.mobius.dis", "application/vnd.mobius.mbk", "application/vnd.mobius.mqy",
"application/vnd.mobius.msl", "application/vnd.mobius.plc", "application/vnd.mobius.txf",
"application/vnd.mophun.application", "application/vnd.mophun.certificate",
"application/vnd.mozilla.xul+xml", "application/vnd.ms-artgalry",
"application/vnd.ms-cab-compressed", "application/vnd.ms-excel",
"application/vnd.ms-excel", "application/vnd.ms-excel", "application/vnd.ms-excel",
"application/vnd.ms-excel", "application/vnd.ms-excel", "application/vnd.ms-excel",
"application/vnd.ms-excel", "application/vnd.ms-excel.addin.macroEnabled.12",
"application/vnd.ms-excel.addin.macroenabled.12", "application/vnd.ms-excel.sheet.binary.macroEnabled.12",
"application/vnd.ms-excel.sheet.binary.macroenabled.12", "application/vnd.ms-excel.sheet.macroEnabled.12",
"application/vnd.ms-excel.sheet.macroenabled.12", "application/vnd.ms-excel.template.macroEnabled.12",
"application/vnd.ms-excel.template.macroenabled.12", "application/vnd.ms-fontobject",
"application/vnd.ms-htmlhelp", "application/vnd.ms-ims", "application/vnd.ms-lrm",
"application/vnd.ms-officetheme", "application/vnd.ms-outlook",
"application/vnd.ms-pki.certstore", "application/vnd.ms-pki.pko",
"application/vnd.ms-pki.seccat", "application/vnd.ms-pki.stl",
"application/vnd.ms-pkicertstore", "application/vnd.ms-pkiseccat",
"application/vnd.ms-pkistl", "application/vnd.ms-powerpoint",
"application/vnd.ms-powerpoint", "application/vnd.ms-powerpoint",
"application/vnd.ms-powerpoint", "application/vnd.ms-powerpoint",
"application/vnd.ms-powerpoint.addin.macroEnabled.12", "application/vnd.ms-powerpoint.addin.macroenabled.12",
"application/vnd.ms-powerpoint.presentation.macroEnabled.12",
"application/vnd.ms-powerpoint.presentation.macroEnabled.12",
"application/vnd.ms-powerpoint.presentation.macroenabled.12",
"application/vnd.ms-powerpoint.presentation.macroenabled.12",
"application/vnd.ms-powerpoint.slide.macroEnabled.12", "application/vnd.ms-powerpoint.slide.macroenabled.12",
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12", "application/vnd.ms-powerpoint.slideshow.macroenabled.12",
"application/vnd.ms-powerpoint.template.macroEnabled.12", "application/vnd.ms-powerpoint.template.macroenabled.12",
"application/vnd.ms-project", "application/vnd.ms-project", "application/vnd.ms-word.document.macroEnabled.12",
"application/vnd.ms-word.document.macroenabled.12", "application/vnd.ms-word.template.macroEnabled.12",
"application/vnd.ms-word.template.macroenabled.12", "application/vnd.ms-works",
"application/vnd.ms-works", "application/vnd.ms-works", "application/vnd.ms-works",
"application/vnd.ms-wpl", "application/vnd.ms-xpsdocument", "application/vnd.mseq",
"application/vnd.musician", "application/vnd.muvee.style", "application/vnd.mynfc",
"application/vnd.neurolanguage.nlu", "application/vnd.nitf",
"application/vnd.nitf", "application/vnd.noblenet-directory",
"application/vnd.noblenet-sealer", "application/vnd.noblenet-web",
"application/vnd.nokia.configuration-message", "application/vnd.nokia.n-gage.data",
"application/vnd.nokia.n-gage.symbian.install", "application/vnd.nokia.radio-preset",
"application/vnd.nokia.radio-presets", "application/vnd.nokia.ringing-tone",
"application/vnd.novadigm.EDM", "application/vnd.novadigm.EDX",
"application/vnd.novadigm.EXT", "application/vnd.novadigm.edm",
"application/vnd.novadigm.edx", "application/vnd.novadigm.ext",
"application/vnd.oasis.opendocument.chart", "application/vnd.oasis.opendocument.chart-template",
"application/vnd.oasis.opendocument.database", "application/vnd.oasis.opendocument.formula",
"application/vnd.oasis.opendocument.formula-template", "application/vnd.oasis.opendocument.graphics",
"application/vnd.oasis.opendocument.graphics-template", "application/vnd.oasis.opendocument.image",
"application/vnd.oasis.opendocument.image-template", "application/vnd.oasis.opendocument.presentation",
"application/vnd.oasis.opendocument.presentation-template", "application/vnd.oasis.opendocument.spreadsheet",
"application/vnd.oasis.opendocument.spreadsheet-template", "application/vnd.oasis.opendocument.text",
"application/vnd.oasis.opendocument.text-master", "application/vnd.oasis.opendocument.text-master",
"application/vnd.oasis.opendocument.text-template", "application/vnd.oasis.opendocument.text-web",
"application/vnd.olpc-sugar", "application/vnd.oma.dd2+xml",
"application/vnd.openofficeorg.extension", "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"application/vnd.openxmlformats-officedocument.presentationml.slide",
"application/vnd.openxmlformats-officedocument.presentationml.slideshow",
"application/vnd.openxmlformats-officedocument.presentationml.template",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.openxmlformats-officedocument.spreadsheetml.template",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.wordprocessingml.template",
"application/vnd.osgeo.mapguide.package", "application/vnd.osgi.dp",
"application/vnd.osgi.subsystem", "application/vnd.palm", "application/vnd.palm",
"application/vnd.palm", "application/vnd.pawaafile", "application/vnd.pg.format",
"application/vnd.pg.osasli", "application/vnd.picsel", "application/vnd.pmi.widget",
"application/vnd.pocketlearn", "application/vnd.powerbuilder6",
"application/vnd.previewsystems.box", "application/vnd.proteus.magazine",
"application/vnd.publishare-delta-tree", "application/vnd.pvi.ptid1",
"application/vnd.quark.quarkxpress", "application/vnd.quark.quarkxpress",
"application/vnd.quark.quarkxpress", "application/vnd.quark.quarkxpress",
"application/vnd.quark.quarkxpress", "application/vnd.quark.quarkxpress",
"application/vnd.realvnc.bed", "application/vnd.recordare.musicxml",
"application/vnd.recordare.musicxml+xml", "application/vnd.rig.cryptonote",
"application/vnd.rim.cod", "application/vnd.rn-realmedia", "application/vnd.rn-realmedia-vbr",
"application/vnd.rn-realplayer", "application/vnd.route66.link66+xml",
"application/vnd.sailingtracker.track", "application/vnd.seemail",
"application/vnd.sema", "application/vnd.semd", "application/vnd.semf",
"application/vnd.shana.informed.formdata", "application/vnd.shana.informed.formtemplate",
"application/vnd.shana.informed.interchange", "application/vnd.shana.informed.package",
"application/vnd.simtech-mindmapper", "application/vnd.simtech-mindmapper",
"application/vnd.smaf", "application/vnd.smart.teacher", "application/vnd.solent.sdkm+xml",
"application/vnd.solent.sdkm+xml", "application/vnd.spotfire.dxp",
"application/vnd.spotfire.sfs", "application/vnd.stardivision.calc",
"application/vnd.stardivision.draw", "application/vnd.stardivision.impress",
"application/vnd.stardivision.impress", "application/vnd.stardivision.math",
"application/vnd.stardivision.writer", "application/vnd.stardivision.writer",
"application/vnd.stardivision.writer-global", "application/vnd.stepmania.package",
"application/vnd.stepmania.stepchart", "application/vnd.sun.xml.calc",
"application/vnd.sun.xml.calc.template", "application/vnd.sun.xml.draw",
"application/vnd.sun.xml.draw.template", "application/vnd.sun.xml.impress",
"application/vnd.sun.xml.impress.template", "application/vnd.sun.xml.math",
"application/vnd.sun.xml.writer", "application/vnd.sun.xml.writer.global",
"application/vnd.sun.xml.writer.template", "application/vnd.sus-calendar",
"application/vnd.sus-calendar", "application/vnd.svd", "application/vnd.symbian.install",
"application/vnd.symbian.install", "application/vnd.syncml+xml",
"application/vnd.syncml.dm+wbxml", "application/vnd.syncml.dm+xml",
"application/vnd.tao.intent-module-archive", "application/vnd.tcpdump.pcap",
"application/vnd.tcpdump.pcap", "application/vnd.tcpdump.pcap",
"application/vnd.tmobile-livetv", "application/vnd.trid.tpt",
"application/vnd.triscape.mxs", "application/vnd.trueapp", "application/vnd.ufdl",
"application/vnd.ufdl", "application/vnd.uiq.theme", "application/vnd.umajin",
"application/vnd.unity", "application/vnd.uoml+xml", "application/vnd.vcx",
"application/vnd.visio", "application/vnd.visio", "application/vnd.visio",
"application/vnd.visio", "application/vnd.visionary", "application/vnd.vsf",
"application/vnd.wap.sic", "application/vnd.wap.slc", "application/vnd.wap.wbxml",
"application/vnd.wap.wmlc", "application/vnd.wap.wmlscriptc",
"application/vnd.webturbo", "application/vnd.wolfram.player",
"application/vnd.wordperfect", "application/vnd.wqd", "application/vnd.wt.stf",
"application/vnd.xara", "application/vnd.xara", "application/vnd.xfdl",
"application/vnd.yamaha.hv-dic", "application/vnd.yamaha.hv-script",
"application/vnd.yamaha.hv-voice", "application/vnd.yamaha.openscoreformat",
"application/vnd.yamaha.openscoreformat.osfpvg+xml", "application/vnd.yamaha.smaf-audio",
"application/vnd.yamaha.smaf-phrase", "application/vnd.yellowriver-custom-menu",
"application/vnd.zul", "application/vnd.zul", "application/vnd.zzazz.deck+xml",
"application/vocaltec-media-desc", "application/vocaltec-media-file",
"application/voicexml+xml", "application/widget", "application/winhlp",
"application/wordperfect", "application/wordperfect", "application/wordperfect",
"application/wordperfect", "application/wordperfect5.1", "application/wordperfect6.0",
"application/wordperfect6.0", "application/wordperfect6.1", "application/wsdl+xml",
"application/wspolicy+xml", "application/x-123", "application/x-123",
"application/x-7z-compressed", "application/x-abiword", "application/x-ace-compressed",
"application/x-aim", "application/x-apple-diskimage", "application/x-authorware-bin",
"application/x-authorware-bin", "application/x-authorware-bin",
"application/x-authorware-bin", "application/x-authorware-map",
"application/x-authorware-seg", "application/x-bcpio", "application/x-binary",
"application/x-binhex40", "application/x-bittorrent", "application/x-blorb",
"application/x-blorb", "application/x-bsh", "application/x-bsh",
"application/x-bsh", "application/x-bytecode.elisp", "application/x-bytecode.elisp(compiledelisp)",
"application/x-bzip", "application/x-bzip2", "application/x-bzip2",
"application/x-cbr", "application/x-cbr", "application/x-cbr",
"application/x-cbr", "application/x-cbr", "application/x-cdf",
"application/x-cdlink", "application/x-cfs-compressed", "application/x-chat",
"application/x-chat", "application/x-chess-pgn", "application/x-chm",
"application/x-chrome-extension", "application/x-cmu-raster",
"application/x-cocoa", "application/x-compactpro", "application/x-compress",
"application/x-compressed", "application/x-compressed", "application/x-compressed",
"application/x-compressed", "application/x-conference", "application/x-cpio",
"application/x-cpt", "application/x-csh", "application/x-debian-package",
"application/x-debian-package", "application/x-deepv", "application/x-dgc-compressed",
"application/x-director", "application/x-director", "application/x-director",
"application/x-director", "application/x-director", "application/x-director",
"application/x-director", "application/x-director", "application/x-director",
"application/x-dms", "application/x-doom", "application/x-dtbncx+xml",
"application/x-dtbook+xml", "application/x-dtbresource+xml",
"application/x-dvi", "application/x-elc", "application/x-envoy",
"application/x-envoy", "application/x-esrehber", "application/x-eva",
"application/x-excel", "application/x-excel", "application/x-excel",
"application/x-excel", "application/x-excel", "application/x-excel",
"application/x-excel", "application/x-excel", "application/x-excel",
"application/x-excel", "application/x-excel", "application/x-flac",
"application/x-font", "application/x-font", "application/x-font",
"application/x-font", "application/x-font", "application/x-font-bdf",
"application/x-font-ghostscript", "application/x-font-linux-psf",
"application/x-font-otf", "application/x-font-pcf", "application/x-font-snf",
"application/x-font-ttf", "application/x-font-ttf", "application/x-font-type1",
"application/x-font-type1", "application/x-font-type1", "application/x-font-type1",
"application/x-font-woff", "application/x-frame", "application/x-freearc",
"application/x-freelance", "application/x-futuresplash", "application/x-gca-compressed",
"application/x-glulx", "application/x-gnumeric", "application/x-go-sgf",
"application/x-gramps-xml", "application/x-graphing-calculator",
"application/x-gsp", "application/x-gss", "application/x-gtar",
"application/x-gtar", "application/x-gtar", "application/x-gzip",
"application/x-gzip", "application/x-gzip", "application/x-hdf",
"application/x-helpfile", "application/x-helpfile", "application/x-httpd-imap",
"application/x-httpd-php", "application/x-httpd-php", "application/x-httpd-php",
"application/x-httpd-php-source", "application/x-httpd-php3",
"application/x-httpd-php3-preprocessed", "application/x-httpd-php4",
"application/x-ica", "application/x-ima", "application/x-install-instructions",
"application/x-internet-signup", "application/x-internet-signup",
"application/x-internett-signup", "application/x-inventor", "application/x-ip2",
"application/x-iphone", "application/x-iso9660-image", "application/x-java-archive",
"application/x-java-class", "application/x-java-commerce", "application/x-java-jnlp-file",
"application/x-java-serialized-object", "application/x-java-vm",
"application/x-javascript", "application/x-kchart", "application/x-killustrator",
"application/x-koan", "application/x-koan", "application/x-koan",
"application/x-koan", "application/x-kpresenter", "application/x-kpresenter",
"application/x-ksh", "application/x-kspread", "application/x-kword",
"application/x-kword", "application/x-latex", "application/x-latex",
"application/x-lha", "application/x-lisp", "application/x-livescreen",
"application/x-lotus", "application/x-lotusscreencam", "application/x-lua-bytecode",
"application/x-lzh", "application/x-lzh-compressed", "application/x-lzh-compressed",
"application/x-lzx", "application/x-mac-binhex40", "application/x-macbinary",
"application/x-magic-cap-package-1.0", "application/x-maker",
"application/x-maker", "application/x-maker", "application/x-maker",
"application/x-maker", "application/x-maker", "application/x-maker",
"application/x-mathcad", "application/x-meme", "application/x-midi",
"application/x-midi", "application/x-mie", "application/x-mif",
"application/x-mix-transfer", "application/x-mobipocket-ebook",
"application/x-mobipocket-ebook", "application/x-mpegURL", "application/x-mplayer2",
"application/x-ms-application", "application/x-ms-shortcut",
"application/x-ms-wmd", "application/x-ms-wmz", "application/x-ms-xbap",
"application/x-msaccess", "application/x-msbinder", "application/x-mscardfile",
"application/x-msclip", "application/x-msdos-program", "application/x-msdos-program",
"application/x-msdos-program", "application/x-msdos-program",
"application/x-msdownload", "application/x-msdownload", "application/x-msdownload",
"application/x-msdownload", "application/x-msdownload", "application/x-msexcel",
"application/x-msexcel", "application/x-msexcel", "application/x-msi",
"application/x-msmediaview", "application/x-msmediaview", "application/x-msmediaview",
"application/x-msmetafile", "application/x-msmetafile", "application/x-msmetafile",
"application/x-msmetafile", "application/x-msmoney", "application/x-mspowerpoint",
"application/x-mspublisher", "application/x-msschedule", "application/x-msterminal",
"application/x-mswrite", "application/x-navi-animation", "application/x-navidoc",
"application/x-navimap", "application/x-navistyle", "application/x-netcdf",
"application/x-netcdf", "application/x-newton-compatible-pkg",
"application/x-nokia-9000-communicator-add-on-software", "application/x-ns-proxy-autoconfig",
"application/x-nwc", "application/x-nzb", "application/x-object",
"application/x-omc", "application/x-omcdatamaker", "application/x-omcregerator",
"application/x-oz-application", "application/x-pagemaker", "application/x-pagemaker",
"application/x-pcl", "application/x-perfmon", "application/x-perfmon",
"application/x-perfmon", "application/x-perfmon", "application/x-perfmon",
"application/x-pixclscript", "application/x-pkcs10", "application/x-pkcs12",
"application/x-pkcs12", "application/x-pkcs7-certificates", "application/x-pkcs7-certificates",
"application/x-pkcs7-certreqresp", "application/x-pkcs7-crl",
"application/x-pkcs7-mime", "application/x-pkcs7-mime", "application/x-pkcs7-signature",
"application/x-pkcs7-signature", "application/x-pointplus", "application/x-portable-anymap",
"application/x-project", "application/x-project", "application/x-project",
"application/x-project", "application/x-python-code", "application/x-python-code",
"application/x-qpro", "application/x-quicktimeplayer", "application/x-rar-compressed",
"application/x-redhat-package-manager", "application/x-research-info-systems",
"application/x-rpm", "application/x-rtf", "application/x-sdp",
"application/x-sea", "application/x-seelogo", "application/x-sh",
"application/x-shar", "application/x-shar", "application/x-shockwave-flash",
"application/x-shockwave-flash", "application/x-silverlight-app",
"application/x-sit", "application/x-sprite", "application/x-sprite",
"application/x-sql", "application/x-stuffit", "application/x-stuffitx",
"application/x-subrip", "application/x-sv4cpio", "application/x-sv4crc",
"application/x-t3vm-image", "application/x-tads", "application/x-tar",
"application/x-tbook", "application/x-tbook", "application/x-tcl",
"application/x-tex", "application/x-tex-gf", "application/x-tex-pk",
"application/x-tex-tfm", "application/x-texinfo", "application/x-texinfo",
"application/x-tgif", "application/x-trash", "application/x-trash",
"application/x-trash", "application/x-trash", "application/x-trash",
"application/x-troff", "application/x-troff", "application/x-troff",
"application/x-troff-man", "application/x-troff-me", "application/x-troff-ms",
"application/x-troff-msvideo", "application/x-ustar", "application/x-visio",
"application/x-visio", "application/x-visio", "application/x-vnd.audioexplosion.mzz",
"application/x-vnd.ls-xpix", "application/x-vrml", "application/x-wais-source",
"application/x-wais-source", "application/x-web-app-manifest+json",
"application/x-wingz", "application/x-winhelp", "application/x-wintalk",
"application/x-world", "application/x-world", "application/x-wpwin",
"application/x-wri", "application/x-x509-ca-cert", "application/x-x509-ca-cert",
"application/x-x509-ca-cert", "application/x-x509-user-cert",
"application/x-xcf", "application/x-xfig", "application/x-xliff+xml",
"application/x-xpinstall", "application/x-xz", "application/x-zip-compressed",
"application/x-zmachine", "application/x-zmachine", "application/x-zmachine",
"application/x-zmachine", "application/x-zmachine", "application/x-zmachine",
"application/x-zmachine", "application/x-zmachine", "application/xaml+xml",
"application/xcap-diff+xml", "application/xenc+xml", "application/xhtml+xml",
"application/xhtml+xml", "application/xml", "application/xml",
"application/xml", "application/xml-dtd", "application/xop+xml",
"application/xproc+xml", "application/xslt+xml", "application/xspf+xml",
"application/xv+xml", "application/xv+xml", "application/xv+xml",
"application/xv+xml", "application/yang", "application/yin+xml",
"application/ynd.ms-pkipko", "application/zip", "audio/adpcm",
"audio/aiff", "audio/aiff", "audio/aiff", "audio/basic", "audio/basic",
"audio/flac", "audio/it", "audio/make", "audio/make", "audio/make",
"audio/make.my.funk", "audio/mid", "audio/mid", "audio/midi",
"audio/midi", "audio/midi", "audio/midi", "audio/mod", "audio/mp4",
"audio/mp4", "audio/mpeg", "audio/mpeg", "audio/mpeg", "audio/mpeg",
"audio/mpeg", "audio/mpeg", "audio/mpeg", "audio/mpeg", "audio/mpeg",
"audio/mpeg", "audio/mpeg3", "audio/mpegurl", "audio/nspaudio",
"audio/nspaudio", "audio/ogg", "audio/ogg", "audio/ogg", "audio/prs.sid",
"audio/s3m", "audio/silk", "audio/tsp-audio", "audio/tsplayer",
"audio/vnd.dece.audio", "audio/vnd.dece.audio", "audio/vnd.digital-winds",
"audio/vnd.dra", "audio/vnd.dts", "audio/vnd.dts.hd", "audio/vnd.lucent.voice",
"audio/vnd.ms-playready.media.pya", "audio/vnd.nuera.ecelp4800",
"audio/vnd.nuera.ecelp7470", "audio/vnd.nuera.ecelp9600", "audio/vnd.qcelp",
"audio/vnd.rip", "audio/voc", "audio/voxware", "audio/wav", "audio/webm",
"audio/x-aac", "audio/x-adpcm", "audio/x-aiff", "audio/x-aiff",
"audio/x-aiff", "audio/x-au", "audio/x-caf", "audio/x-flac",
"audio/x-gsm", "audio/x-gsm", "audio/x-jam", "audio/x-liveaudio",
"audio/x-matroska", "audio/x-mid", "audio/x-mid", "audio/x-midi",
"audio/x-midi", "audio/x-mod", "audio/x-mpeg", "audio/x-mpeg-3",
"audio/x-mpegurl", "audio/x-mpequrl", "audio/x-ms-wax", "audio/x-ms-wma",
"audio/x-nspaudio", "audio/x-nspaudio", "audio/x-pn-realaudio",
"audio/x-pn-realaudio", "audio/x-pn-realaudio", "audio/x-pn-realaudio",
"audio/x-pn-realaudio", "audio/x-pn-realaudio-plugin", "audio/x-pn-realaudio-plugin",
"audio/x-pn-realaudio-plugin", "audio/x-psid", "audio/x-realaudio",
"audio/x-scpls", "audio/x-sd2", "audio/x-twinvq", "audio/x-twinvq-plugin",
"audio/x-twinvq-plugin", "audio/x-vnd.audioexplosion.mjuicemediafile",
"audio/x-voc", "audio/x-wav", "audio/xm", "chemical/x-cdx", "chemical/x-cif",
"chemical/x-cmdf", "chemical/x-cml", "chemical/x-csml", "chemical/x-pdb",
"chemical/x-pdb", "chemical/x-xyz", "drawing/x-dwf", "drawing/x-dwf(old)",
"font/opentype", "i-world/i-vrml", "image/bmp", "image/bmp",
"image/cgm", "image/cis-cod", "image/cmu-raster", "image/cmu-raster",
"image/fif", "image/florian", "image/florian", "image/g3fax",
"image/gif", "image/ief", "image/ief", "image/jpeg", "image/jpeg",
"image/jpeg", "image/jpeg", "image/jpeg", "image/jutvision",
"image/ktx", "image/naplps", "image/naplps", "image/pcx", "image/pict",
"image/pict", "image/pipeg", "image/pjpeg", "image/pjpeg", "image/pjpeg",
"image/pjpeg", "image/png", "image/png", "image/prs.btif", "image/sgi",
"image/svg+xml", "image/svg+xml", "image/tiff", "image/tiff",
"image/vasa", "image/vnd.adobe.photoshop", "image/vnd.dece.graphic",
"image/vnd.dece.graphic", "image/vnd.dece.graphic", "image/vnd.dece.graphic",
"image/vnd.djvu", "image/vnd.djvu", "image/vnd.dvb.subtitle",
"image/vnd.dwg", "image/vnd.dwg", "image/vnd.dwg", "image/vnd.dxf",
"image/vnd.fastbidsheet", "image/vnd.fpx", "image/vnd.fpx", "image/vnd.fst",
"image/vnd.fujixerox.edmics-mmr", "image/vnd.fujixerox.edmics-rlc",
"image/vnd.ms-modi", "image/vnd.ms-photo", "image/vnd.net-fpx",
"image/vnd.net-fpx", "image/vnd.rn-realflash", "image/vnd.rn-realpix",
"image/vnd.wap.wbmp", "image/vnd.xiff", "image/webp", "image/x-3ds",
"image/x-cmu-rast", "image/x-cmu-raster", "image/x-cmx", "image/x-coreldraw",
"image/x-coreldrawpattern", "image/x-coreldrawtemplate", "image/x-corelphotopaint",
"image/x-dwg", "image/x-dwg", "image/x-dwg", "image/x-freehand",
"image/x-freehand", "image/x-freehand", "image/x-freehand", "image/x-freehand",
"image/x-icon", "image/x-jg", "image/x-jng", "image/x-jps", "image/x-mrsid-image",
"image/x-ms-bmp", "image/x-niff", "image/x-niff", "image/x-pcx",
"image/x-photoshop", "image/x-pict", "image/x-pict", "image/x-portable-anymap",
"image/x-portable-bitmap", "image/x-portable-graymap", "image/x-portable-greymap",
"image/x-portable-pixmap", "image/x-quicktime", "image/x-quicktime",
"image/x-quicktime", "image/x-rgb", "image/x-tga", "image/x-tiff",
"image/x-tiff", "image/x-windows-bmp", "image/x-xbitmap", "image/x-xbitmap",
"image/x-xbm", "image/x-xpixmap", "image/x-xpixmap", "image/x-xwd",
"image/x-xwindowdump", "image/xbm", "image/xpm", "message/rfc822",
"message/rfc822", "message/rfc822", "message/rfc822", "message/rfc822",
"model/iges", "model/iges", "model/mesh", "model/mesh", "model/mesh",
"model/vnd.collada+xml", "model/vnd.dwf", "model/vnd.gdl", "model/vnd.gtw",
"model/vnd.mts", "model/vnd.vtu", "model/vrml", "model/vrml",
"model/vrml", "model/x-pov", "model/x3d+binary", "model/x3d+binary",
"model/x3d+vrml", "model/x3d+vrml", "model/x3d+xml", "model/x3d+xml",
"multipart/x-gzip", "multipart/x-ustar", "multipart/x-zip", "music/crescendo",
"music/crescendo", "music/x-karaoke", "paleovu/x-pv", "text/asp",
"text/cache-manifest", "text/cache-manifest", "text/calendar",
"text/calendar", "text/calendar", "text/comma-separated-values",
"text/css", "text/csv", "text/ecmascript", "text/event-stream",
"text/h323", "text/html", "text/html", "text/html", "text/html",
"text/html", "text/html", "text/html", "text/iuls", "text/javascript",
"text/mathml", "text/mcf", "text/n3", "text/pascal", "text/plain",
"text/plain", "text/plain", "text/plain", "text/plain", "text/plain",
"text/plain", "text/plain", "text/plain", "text/plain", "text/plain",
"text/plain", "text/plain", "text/plain", "text/plain", "text/plain",
"text/plain", "text/plain", "text/plain", "text/plain", "text/plain",
"text/plain", "text/plain", "text/plain", "text/plain", "text/plain",
"text/plain", "text/plain", "text/plain", "text/plain", "text/plain",
"text/plain", "text/plain-bas", "text/prs.lines.tag", "text/richtext",
"text/richtext", "text/richtext", "text/rtf", "text/scriplet",
"text/scriptlet", "text/scriptlet", "text/sgml", "text/sgml",
"text/tab-separated-values", "text/texmacs", "text/texmacs",
"text/troff", "text/troff", "text/troff", "text/troff", "text/troff",
"text/troff", "text/turtle", "text/uri-list", "text/uri-list",
"text/uri-list", "text/uri-list", "text/uri-list", "text/vcard",
"text/vnd.abc", "text/vnd.curl", "text/vnd.curl.dcurl", "text/vnd.curl.mcurl",
"text/vnd.curl.scurl", "text/vnd.dvb.subtitle", "text/vnd.fly",
"text/vnd.fmi.flexstor", "text/vnd.graphviz", "text/vnd.in3d.3dml",
"text/vnd.in3d.spot", "text/vnd.rn-realtext", "text/vnd.sun.j2me.app-descriptor",
"text/vnd.wap.si", "text/vnd.wap.sl", "text/vnd.wap.wml", "text/vnd.wap.wmlscript",
"text/vtt", "text/webviewhtml", "text/x-asm", "text/x-asm", "text/x-audiosoft-intra",
"text/x-c", "text/x-c", "text/x-c", "text/x-c", "text/x-c", "text/x-c",
"text/x-c", "text/x-c++hdr", "text/x-c++hdr", "text/x-c++hdr",
"text/x-c++hdr", "text/x-c++src", "text/x-c++src", "text/x-c++src",
"text/x-c++src", "text/x-chdr", "text/x-component", "text/x-csh",
"text/x-csrc", "text/x-fortran", "text/x-fortran", "text/x-fortran",
"text/x-fortran", "text/x-h", "text/x-h", "text/x-java", "text/x-java-source",
"text/x-java-source", "text/x-la-asf", "text/x-lua", "text/x-m",
"text/x-markdown", "text/x-markdown", "text/x-markdown", "text/x-moc",
"text/x-nfo", "text/x-opml", "text/x-pascal", "text/x-pascal",
"text/x-pcs-gcd", "text/x-perl", "text/x-perl", "text/x-python",
"text/x-script", "text/x-script.csh", "text/x-script.elisp",
"text/x-script.guile", "text/x-script.ksh", "text/x-script.lisp",
"text/x-script.perl", "text/x-script.perl-module", "text/x-script.phyton",
"text/x-script.rexx", "text/x-script.scheme", "text/x-script.sh",
"text/x-script.tcl", "text/x-script.tcsh", "text/x-script.zsh",
"text/x-server-parsed-html", "text/x-server-parsed-html", "text/x-setext",
"text/x-sfv", "text/x-sgml", "text/x-sgml", "text/x-sh", "text/x-speech",
"text/x-speech", "text/x-tcl", "text/x-tcl", "text/x-tex", "text/x-tex",
"text/x-tex", "text/x-tex", "text/x-uil", "text/x-uuencode",
"text/x-uuencode", "text/x-vcalendar", "text/x-vcard", "text/xml",
"video/3gpp", "video/3gpp2", "video/MP2T", "video/animaflex",
"video/avi", "video/avs-video", "video/dl", "video/flc", "video/flc",
"video/fli", "video/fli", "video/gl", "video/h261", "video/h263",
"video/h264", "video/jpeg", "video/jpm", "video/jpm", "video/mj2",
"video/mj2", "video/mp4", "video/mp4", "video/mp4", "video/mpeg",
"video/mpeg", "video/mpeg", "video/mpeg", "video/mpeg", "video/mpeg",
"video/mpeg", "video/mpeg", "video/mpeg", "video/msvideo", "video/ogg",
"video/quicktime", "video/quicktime", "video/quicktime", "video/vdo",
"video/vivo", "video/vivo", "video/vnd.dece.hd", "video/vnd.dece.hd",
"video/vnd.dece.mobile", "video/vnd.dece.mobile", "video/vnd.dece.pd",
"video/vnd.dece.pd", "video/vnd.dece.sd", "video/vnd.dece.sd",
"video/vnd.dece.video", "video/vnd.dece.video", "video/vnd.dvb.file",
"video/vnd.fvt", "video/vnd.mpegurl", "video/vnd.mpegurl", "video/vnd.ms-playready.media.pyv",
"video/vnd.rn-realvideo", "video/vnd.uvvu.mp4", "video/vnd.uvvu.mp4",
"video/vnd.vivo", "video/vnd.vivo", "video/vosaic", "video/webm",
"video/x-amt-demorun", "video/x-amt-showrun", "video/x-atomic3d-feature",
"video/x-dl", "video/x-dv", "video/x-dv", "video/x-f4v", "video/x-fli",
"video/x-flv", "video/x-gl", "video/x-isvideo", "video/x-la-asf",
"video/x-la-asf", "video/x-m4v", "video/x-matroska", "video/x-matroska",
"video/x-matroska", "video/x-mng", "video/x-motion-jpeg", "video/x-mpeg",
"video/x-mpeg", "video/x-mpeq2a", "video/x-ms-asf", "video/x-ms-asf",
"video/x-ms-asf", "video/x-ms-asf-plugin", "video/x-ms-vob",
"video/x-ms-wm", "video/x-ms-wmv", "video/x-ms-wmx", "video/x-ms-wvx",
"video/x-msvideo", "video/x-qtc", "video/x-scm", "video/x-sgi-movie",
"video/x-sgi-movie", "video/x-smv", "windows/metafile", "www/mime",
"x-conference/x-cooltalk", "x-music/x-midi", "x-music/x-midi",
"x-world/x-3dmf", "x-world/x-3dmf", "x-world/x-3dmf", "x-world/x-3dmf",
"x-world/x-svr", "x-world/x-vrml", "x-world/x-vrml", "x-world/x-vrml",
"x-world/x-vrml", "x-world/x-vrml", "x-world/x-vrml", "x-world/x-vrml",
"x-world/x-vrt", "xgl/drawing", "xgl/movie", "application/mathematica",
"application/msword", "application/octet-stream", "application/onenote",
"application/pgp-signature", "application/pkcs7-mime", "application/postscript",
"application/smil+xml", "application/vnd.acucorp", "application/vnd.clonk.c4group",
"application/vnd.eszigno3+xml", "application/vnd.fdsn.seed",
"application/vnd.framemaker", "application/vnd.geometry-explorer",
"application/vnd.grafeq", "application/vnd.ibm.modcap", "application/vnd.iccprofile",
"application/vnd.intercon.formnet", "application/vnd.kahootz",
"application/vnd.kde.kpresenter", "application/vnd.kde.kword",
"application/vnd.kinar", "application/vnd.koan", "application/vnd.ms-excel",
"application/vnd.ms-powerpoint", "application/vnd.ms-project",
"application/vnd.ms-works", "application/vnd.palm", "application/vnd.quark.quarkxpress",
"application/vnd.simtech-mindmapper", "application/vnd.solent.sdkm+xml",
"application/vnd.sus-calendar", "application/vnd.symbian.install",
"application/vnd.ufdl", "application/vnd.visio", "application/vnd.zul",
"application/x-authorware-bin", "application/x-bzip2", "application/x-debian-package",
"application/x-director", "application/x-font-ttf", "application/x-font-type1",
"application/x-mobipocket-ebook", "application/x-msdownload",
"application/x-msmediaview", "application/x-netcdf", "application/x-pkcs12",
"application/x-pkcs7-certificates", "application/x-texinfo",
"application/x-x509-ca-cert", "application/xhtml+xml", "application/xml",
"application/xv+xml", "audio/basic", "audio/midi", "audio/mpeg",
"audio/ogg", "audio/x-aiff", "audio/x-pn-realaudio", "image/jpeg",
"image/svg+xml", "image/tiff", "image/vnd.djvu", "image/x-freehand",
"image/x-pict", "message/rfc822", "model/iges", "model/mesh",
"model/vrml", "text/calendar", "text/html", "text/plain", "text/sgml",
"text/troff", "text/uri-list", "text/x-asm", "text/x-c", "text/x-fortran",
"text/x-pascal", "video/jpm", "video/mj2", "video/mp4", "video/mpeg",
"video/quicktime", "video/vnd.mpegurl", "video/x-ms-asf")), row.names = c(NA,
-1763L), class = c("tbl_df", "tbl", "data.frame"), .Names = c("extension",
"mime_type")) -> simplemagic_mime_db
#' @keywords datasets
#' @references
#' - <https://tools.ietf.org/html/rfc6838>
#' - <https://www.iana.org/assignments/media-types/media-types.xhtml>
#' - <https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json>
#' - <https://cdn.jsdelivr.net/gh/jshttp/mime-db@@master/db.json>
#' @note Last updated 2019-07-27.
NULL

16
R/get-content-type.R

@ -1,21 +1,21 @@
#' Discover MIME type of a file based on contents
#'
#' There are a limited number of header "magic" bytes checked directly by
#' this function but cover quite a bit of ground. After that, [guess_content_type()] is called which uses
#' file extension-to-MIME mappings. File an issue or PR if more magic-byte-level
#' comparisons are required/desired. If no match is found, `???` is returned.
#' this function but cover quite a bit of ground. After that, [guess_content_type()]
#' is called which uses file extension-to-MIME mappings.
#'
#' @details
#' Initial in-R header mapping logic borrowed from `MimeTypes.java` from
#' [`servoy-client`](https://github.com/Servoy/servoy-client)
#' File an issue or PR if more magic-byte-level
#' comparisons are required/desired. If no match is found, `???` is returned
#' (see [guess_content_type()] for how to override this behaviour).
#'
#' @md
#' @param path path to a file
#' @param ... passed on to [guess_content_type()]
#' @return character vector
#' @export
#' @examples
#' get_content_type(system.file("extdat", "test.pdf", package="wand"))
get_content_type <- function(path) {
get_content_type <- function(path, ...) {
path <- path.expand(path)
if (!file.exists(path)) stop("File not found.", call.=FALSE)
@ -132,6 +132,6 @@ get_content_type <- function(path) {
if (all(c(0x00,0x00,0x01,0xB3) == hdr[1:4])) return("video/mpeg")
return(guess_content_type(path))
return(guess_content_type(path, ...))
}

48
R/guess-content-type.R

@ -1,31 +1,59 @@
#' Guess MIME type from filename (extension)
#'
#' Uses an internal database of over 1,500 file extension-to-MIME mappings to
#' Uses an internal database of over 1,800 file extension-to-MIME mappings to
#' return one or more associated types for a given input path. If no match is
#' found, `???` is returned.
#'
#' @details
#' Incorporates standard IANA MIME extension mappings and those from
#' [`servoy-client`](https://github.com/Servoy/servoy-client) and
#' [stevenwdv](https://github.com/stevenwdv)'s
#' [`allMimeTypes.json`](https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json).
#'
#' @md
#' @param path path to file
#' @param not_found MIME type to use when the content cannot be guessed by
#' file type.
#' @param custom_dbs a single data frames each with two columns:
#' `mime_type` and `extension`. These sources will be used along with
#' the built-in sources and will take priority over the built-in sources.
#' Note that the `extension`s should be lower case as they are in the
#' official MIME database.
#' @return character vector
#' @export
#' @examples
#' guess_content_type(system.file("extdat", "test.pdf", package="wand"))
guess_content_type <- function(path) {
guess_content_type <- function(path, not_found = "???", custom_db = NULL) {
path <- path.expand(path)
if (!file.exists(path)) stop("File not found.", call.=FALSE)
if (is.null(custom_db)) {
db <- simplemagic_mime_db
} else {
if (inherits(custom_db, "data.frame")) {
if (!all(c("mime_type", "extension") %in% colnames(custom_db))) {
stop(
"'custom_db' must have both 'mime_type' and 'extension' columns.",
call.=FALSE
)
}
rbind.data.frame(
custom_db[, c("mime_type", "extension")],
simplemagic_mime_db
) -> db
db[["mime_type"]] <- as.character(db[["mime_type"]])
db[["extension"]] <- as.character(db[["extension"]])
} else {
stop("'custom_db' must be data frame.", call.=FALSE)
}
}
extension <- trimws(tolower(tools::file_ext(path)))
res <- simplemagic_mime_db[(simplemagic_mime_db$extension == extension),]$mime_type
res <- db[(db$extension == extension),]$mime_type
if (length(res) == 0) return("???")
if (length(res) == 0) return(not_found)
return(unique(res))

BIN
R/sysdata.rda

Binary file not shown.

11
README.Rmd

@ -11,14 +11,9 @@ hrbrpkghelpr::global_opts()
hrbrpkghelpr::stinking_badges()
```
# wand
Lightweight File 'MIME' Type Detection Based On Contents or Extension
## Description
'MIME' types are shorthand descriptors for file contents and can be
determined from "magic" bytes in file headers, file contents or intuited from file extensions. Tools are provided to perform curated "magic" tests as well as mapping 'MIME' types from a database of over 1,500 extension mappings.
```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```
## SOME IMPORTANT DETAILS

23
README.md

@ -5,7 +5,7 @@ developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.re
[![Signed
by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/hrbrmstr)
![Signed commit
%](https://img.shields.io/badge/Signed_Commits-24.4%25-lightgrey.svg)
%](https://img.shields.io/badge/Signed_Commits-26.1%25-lightgrey.svg)
[![Linux build
Status](https://travis-ci.org/hrbrmstr/wand.svg?branch=master)](https://travis-ci.org/hrbrmstr/wand)
[![Windows build
@ -22,14 +22,14 @@ Version](https://img.shields.io/badge/R%3E%3D-3.2.0-blue.svg)
# wand
Lightweight File ‘MIME’ Type Detection Based On Contents or Extension
Retrieve Magic Attributes from Files and Directories
## Description
MIME types are shorthand descriptors for file contents and can be
MIME types are shorthand descriptors for file contents and can be
determined from “magic” bytes in file headers, file contents or intuited
from file extensions. Tools are provided to perform curated “magic”
tests as well as mapping ‘MIME’ types from a database of over 1,500
tests as well as mapping MIME types from a database of over 1,800
extension mappings.
## SOME IMPORTANT DETAILS
@ -77,7 +77,7 @@ library(tidyverse)
# current verison
packageVersion("wand")
## [1] '0.5.0'
## [1] '0.6.0'
```
``` r
@ -120,11 +120,13 @@ list.files(system.file("extdat", package="wand"), full.names=TRUE) %>%
| test.bmp | image/bmp |
| test.dtd | application/xml-dtd |
| test.emf | application/x-msmetafile |
| test.emf | image/emf |
| test.eps | application/postscript |
| test.fli | video/flc |
| test.fli | video/fli |
| test.fli | video/x-fli |
| test.gif | image/gif |
| test.ico | image/vnd.microsoft.icon |
| test.ico | image/x-icon |
| test.jpg | image/jpeg |
| test.mp3 | audio/mp3 |
@ -132,8 +134,10 @@ list.files(system.file("extdat", package="wand"), full.names=TRUE) %>%
| test.ogg | application/ogg |
| test.ogg | audio/ogg |
| test.pcx | image/pcx |
| test.pcx | image/vnd.zbrush.pcx |
| test.pcx | image/x-pcx |
| test.pdf | application/pdf |
| test.pl | application/x-perl |
| test.pl | text/plain |
| test.pl | text/x-perl |
| test.pl | text/x-script.perl |
@ -156,16 +160,19 @@ list.files(system.file("extdat", package="wand"), full.names=TRUE) %>%
| test.sh | text/x-script.sh |
| test.sh | text/x-sh |
| test.tar | application/tar |
| test.tar.gz | application/gzip |
| test.tar.gz | application/octet-stream |
| test.tar.gz | application/x-compressed |
| test.tar.gz | application/x-gzip |
| test.tga | image/x-tga |
| test.txt | text/plain |
| test.txt.gz | application/gzip |
| test.txt.gz | application/octet-stream |
| test.txt.gz | application/x-compressed |
| test.txt.gz | application/x-gzip |
| test.wav | audio/x-wav |
| test.wmf | application/x-msmetafile |
| test.wmf | image/wmf |
| test.wmf | windows/metafile |
| test.xcf | application/x-xcf |
| test.xml | application/xml |
@ -180,9 +187,9 @@ list.files(system.file("extdat", package="wand"), full.names=TRUE) %>%
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) |
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: |
| R | 7 | 0.78 | 949 | 0.91 | 52 | 0.72 | 62 | 0.65 |
| JSON | 1 | 0.11 | 80 | 0.08 | 0 | 0.00 | 0 | 0.00 |
| Rmd | 1 | 0.11 | 16 | 0.02 | 20 | 0.28 | 34 | 0.35 |
| R | 7 | 0.78 | 154 | 0.61 | 59 | 0.78 | 70 | 0.69 |
| JSON | 1 | 0.11 | 80 | 0.32 | 0 | 0.00 | 0 | 0.00 |
| Rmd | 1 | 0.11 | 17 | 0.07 | 17 | 0.22 | 31 | 0.31 |
## Code of Conduct

87
inst/tinytest/test_wand.R

@ -4,49 +4,35 @@ list(
actions.csv = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
actions.txt = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
actions.xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
test_128_44_jstereo.mp3 = "audio/mp3",
test_excel_2000.xls = "application/msword",
test_excel_spreadsheet.xml = "application/xml",
test_excel_web_archive.mht = "message/rfc822",
test_excel.xlsm = "application/zip",
test_excel.xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
test_nocompress.tif = "image/tiff",
test_powerpoint.pptm = "application/zip",
test_128_44_jstereo.mp3 = "audio/mp3", test_excel_2000.xls = "application/msword",
test_excel_spreadsheet.xml = "application/xml", test_excel_web_archive.mht = "message/rfc822",
test_excel.xlsm = "application/zip", test_excel.xlsx = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
test_nocompress.tif = "image/tiff", test_powerpoint.pptm = "application/zip",
test_powerpoint.pptx = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
test_word_2000.doc = "application/msword",
test_word_6.0_95.doc = "application/msword",
test_word.docm = "application/zip",
test_word.docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
test.au = "audio/basic",
test.bin = c(
test_word_2000.doc = "application/msword", test_word_6.0_95.doc = "application/msword",
test_word.docm = "application/zip", test_word.docx = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
test.au = "audio/basic", test.bin = c(
"application/mac-binary",
"application/macbinary", "application/octet-stream", "application/x-binary",
"application/x-macbinary"
), test.bmp = "image/bmp",
test.dtd = "application/xml-dtd",
test.emf = "application/x-msmetafile",
test.eps = "application/postscript",
test.fli = c("video/flc", "video/fli", "video/x-fli"),
test.gif = "image/gif",
test.ico = "image/x-icon",
test.jpg = "image/jpeg",
test.mp3 = "audio/mp3",
test.odt = "application/vnd.oasis.opendocument.text",
test.ogg = c(
"application/ogg",
"audio/ogg"
), test.pcx = c("image/pcx", "image/x-pcx"),
test.pdf = "application/pdf",
test.pl = c("text/plain", "text/x-perl", "text/x-script.perl"),
test.png = "image/png",
test.pnm = c(
), test.bmp = "image/bmp", test.dtd = "application/xml-dtd",
test.emf = c("application/x-msmetafile", "image/emf"), test.eps = "application/postscript",
test.fli = c("video/flc", "video/fli", "video/x-fli"), test.gif = "image/gif",
test.ico = c("image/vnd.microsoft.icon", "image/x-icon"),
test.jpg = "image/jpeg", test.mp3 = "audio/mp3", test.odt = "application/vnd.oasis.opendocument.text",
test.ogg = c("application/ogg", "audio/ogg"), test.pcx = c(
"image/pcx",
"image/vnd.zbrush.pcx", "image/x-pcx"
), test.pdf = "application/pdf",
test.pl = c(
"application/x-perl", "text/plain", "text/x-perl",
"text/x-script.perl"
), test.png = "image/png", test.pnm = c(
"application/x-portable-anymap",
"image/x-portable-anymap"
), test.ppm = "image/x-portable-pixmap",
test.ppt = "application/msword",
test.ps = "application/postscript",
test.psd = "image/photoshop",
test.py = c(
test.ppt = "application/msword", test.ps = "application/postscript",
test.psd = "image/photoshop", test.py = c(
"text/x-python",
"text/x-script.phyton"
), test.rtf = c(
@ -56,21 +42,20 @@ list(
"application/x-bsh",
"application/x-sh", "application/x-shar", "text/x-script.sh",
"text/x-sh"
), test.tar = "application/tar",
test.tar.gz = c(
"application/octet-stream",
"application/x-compressed", "application/x-gzip"
), test.tga = "image/x-tga",
test.txt = "text/plain",
test.txt.gz = c(
"application/octet-stream",
"application/x-compressed", "application/x-gzip"
), test.wav = "audio/x-wav",
test.wmf = c("application/x-msmetafile", "windows/metafile"),
test.xcf = "application/x-xcf",
test.xml = "application/xml",
test.xpm = c("image/x-xbitmap", "image/x-xpixmap", "image/xpm"),
test.zip = "application/zip"
), test.tar = "application/tar", test.tar.gz = c(
"application/gzip",
"application/octet-stream", "application/x-compressed", "application/x-gzip"
), test.tga = "image/x-tga", test.txt = "text/plain", test.txt.gz = c(
"application/gzip",
"application/octet-stream", "application/x-compressed", "application/x-gzip"
), test.wav = "audio/x-wav", test.wmf = c(
"application/x-msmetafile",
"image/wmf", "windows/metafile"
), test.xcf = "application/x-xcf",
test.xml = "application/xml", test.xpm = c(
"image/x-xbitmap",
"image/x-xpixmap", "image/xpm"
), test.zip = "application/zip"
) -> results
fils <- list.files(system.file("extdat", package="wand"), full.names=TRUE)

14
man/get_content_type.Rd

@ -4,23 +4,25 @@
\alias{get_content_type}
\title{Discover MIME type of a file based on contents}
\usage{
get_content_type(path)
get_content_type(path, ...)
}
\arguments{
\item{path}{path to a file}
\item{...}{passed on to \code{\link[=guess_content_type]{guess_content_type()}}}
}
\value{
character vector
}
\description{
There are a limited number of header "magic" bytes checked directly by
this function but cover quite a bit of ground. After that, \code{\link[=guess_content_type]{guess_content_type()}} is called which uses
file extension-to-MIME mappings. File an issue or PR if more magic-byte-level
comparisons are required/desired. If no match is found, \code{???} is returned.
this function but cover quite a bit of ground. After that, \code{\link[=guess_content_type]{guess_content_type()}}
is called which uses file extension-to-MIME mappings.
}
\details{
Initial in-R header mapping logic borrowed from \code{MimeTypes.java} from
\href{https://github.com/Servoy/servoy-client}{servoy-client}
File an issue or PR if more magic-byte-level
comparisons are required/desired. If no match is found, \code{???} is returned
(see \code{\link[=guess_content_type]{guess_content_type()}} for how to override this behaviour).
}
\examples{
get_content_type(system.file("extdat", "test.pdf", package="wand"))

19
man/guess_content_type.Rd

@ -4,25 +4,28 @@
\alias{guess_content_type}
\title{Guess MIME type from filename (extension)}
\usage{
guess_content_type(path)
guess_content_type(path, not_found = "???", custom_db = NULL)
}
\arguments{
\item{path}{path to file}
\item{not_found}{MIME type to use when the content cannot be guessed by
file type.}
\item{custom_dbs}{a single data frames each with two columns:
\code{mime_type} and \code{extension}. These sources will be used along with
the built-in sources and will take priority over the built-in sources.
Note that the \code{extension}s should be lower case as they are in the
official MIME database.}
}
\value{
character vector
}
\description{
Uses an internal database of over 1,500 file extension-to-MIME mappings to
Uses an internal database of over 1,800 file extension-to-MIME mappings to
return one or more associated types for a given input path. If no match is
found, \code{???} is returned.
}
\details{
Incorporates standard IANA MIME extension mappings and those from
\href{https://github.com/Servoy/servoy-client}{servoy-client} and
\href{https://github.com/stevenwdv}{stevenwdv}'s
\href{https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json}{allMimeTypes.json}.
}
\examples{
guess_content_type(system.file("extdat", "test.pdf", package="wand"))
}

15
man/simplemagic_mime_db.Rd

@ -4,11 +4,16 @@
\name{simplemagic_mime_db}
\alias{simplemagic_mime_db}
\title{File extension-to-MIME mapping data frame}
\format{An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 1763 rows and 2 columns.}
\usage{
simplemagic_mime_db
}
\description{
File extension-to-MIME mapping data frame
built from the files found in the References
}
\note{
Last updated 2019-07-27.
}
\references{
- <https://tools.ietf.org/html/rfc6838>
- <https://www.iana.org/assignments/media-types/media-types.xhtml>
- <https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json>
- <https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json>
}
\keyword{datasets}

31
tools/build-ext-db.R

@ -0,0 +1,31 @@
library(tidyverse)
a <- jsonlite::fromJSON("https://s-randomfiles.s3.amazonaws.com/mime/allMimeTypes.json")
b <- jsonlite::fromJSON("https://cdn.jsdelivr.net/gh/jshttp/mime-db@master/db.json")
aa <- map(a, compact)
aa <- keep(aa, lengths(aa)>0)
bb <- keep(b, ~"extensions" %in% names(.x))
map_df(names(aa), ~{
tibble(
extension = aa[[.x]],
mime_type = .x
) %>% unnest()
}) -> aa_df
map_df(names(bb), ~{
tibble(
extension = bb[[.x]][["extensions"]],
mime_type = .x
) %>% unnest()
}) -> bb_df
bind_rows(aa_df, bb_df, read_csv("tools/orig-db.csv", col_types = "cc")) %>%
distinct() %>%
arrange(extension, mime_type) %>%
mutate_all(as.character) %>%
mutate_all(trimws) -> simplemagic_mime_db
use_data(simplemagic_mime_db, internal = TRUE, overwrite = TRUE)

1764
tools/orig-db.csv

File diff suppressed because it is too large
Loading…
Cancel
Save