file: a character vector of filenames, or filename extensions
unknown: the MIME type to return when the file extension was not found in the table
empty: the MIME type for files that do not have extensions
mime_extra: a named character vector of the form c(extension = type)
providing extra MIME types (by default, mime:::mimeextra); note this MIME table takes precedence over the standard table mimemap
subtype: a character vector of MIME subtypes, which should be of the same length as file if provided (use an empty character string for a file if we do not want a subtype for it)
Examples
library(mime)# well-known file typesguess_type(c("a/b/c.html","d.pdf","e.odt","foo.docx","tex"))# not in the standard table, but in mimeextraguess_type(c("a.md","b.R"), mime_extra =NULL)guess_type(c("a.md","b.R"))# override the standard MIME table (tex is text/x-tex by default)guess_type("tex", mime_extra = c(tex ="text/plain"))# unknown extension 'zzz'guess_type("foo.zzz")# force unknown types to be plain textguess_type("foo.zzz", unknown ="text/plain")# empty file extensionguess_type("Makefile")# we know it is a plain text fileguess_type("Makefile", empty ="text/plain")# subtypesguess_type(c("abc.html","def.htm"), subtype = c("charset=UTF-8",""))