Map Filenames to MIME Types

Guesses the MIME type from a filename extension using the data derived from /etc/mime.types in UNIX-type systems.


Build Status

This is an R package for mapping filename extensions to MIME types, based on the data derived from /etc/mime.types.

# installation
install.packages('mime')
 
library(mime)
guess_type(c('a/b/c.html', 'd.pdf', 'e.odt', 'foo.docx', 'tex'))
# [1] "text/html"                                                              
# [2] "application/pdf"                                                        
# [3] "application/vnd.oasis.opendocument.text"                                
# [4] "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
# [5] "text/x-tex"

News

	 CHANGES IN mime VERSION 0.6

MINOR CHANGES

o Updated the MIME types from Ubuntu 18.04.

	 CHANGES IN mime VERSION 0.5

MAJOR CHANGES

o the package license was changed from GPL-2 to GPL

	 CHANGES IN mime VERSION 0.4

NEW FEATURES

o added a new content type: .geojson -> application/vnd.geo+json (thanks, @dmpe, #3)

BUG FIXES

o guess_type() may fail on Windows when the file paths are too long (#2)

	 CHANGES IN mime VERSION 0.3

NEW FEATURES

o added a few more content types

	 CHANGES IN mime VERSION 0.2

NEW FEATURES

o added a function parse_multipart() to parse multipart form data submitted via HTTP POST

	 CHANGES IN mime VERSION 0.1.2

BUG FIXES

o guess_type() returned wrong values for filenames without extensions: it should have used the 'empty' argument.

	 CHANGES IN mime VERSION 0.1.1

BUG FIXES

o mime::guess_type() may not work when mime is loaded but not attached, because R does not load the mimemap data in this case. Now mimemap is exported in the package namespace.

	 CHANGES IN mime VERSION 0.1

NEW FEATURES

o The initial version of mime. The main function is mime::guess_type().

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("mime")

0.7 by Yihui Xie, a month ago


https://github.com/yihui/mime


Report a bug at https://github.com/yihui/mime/issues


Browse source code at https://github.com/cran/mime


Authors: Yihui Xie [aut, cre] , Jeffrey Horner [ctb] , Beilei Bian [ctb]


Documentation:   PDF Manual  


Task views: Web Technologies and Services


GPL license


Imports tools


Imported by AzureStor, MazamaWebUtils, RSocrata, boxr, crul, distill, gmailr, handlr, httr, markdown, mongolite, opalr, opencpu, radix, rmarkdown, servr, shiny, sofa, solvebio.

Suggested by eq5d, xfun.


See at CRAN