Map filenames to MIME types
R C
Switch branches/tags
Clone or download
Latest commit 9da4342 Aug 31, 2017

README.md

mime

Build Status

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

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"

You can install the stable version from CRAN, or the development version from XRAN:

# CRAN version
install.packages('mime', repos = 'https://cran.rstudio.com')
# development version
install.packages('mime', repos = 'http://yihui.name/xran')