Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yihui/mime

Map filenames to MIME types
https://github.com/yihui/mime

mime-types r

Last synced: 9 days ago
JSON representation

Map filenames to MIME types

Awesome Lists containing this project

README

        

# mime

[![R-CMD-check](https://github.com/yihui/mime/workflows/R-CMD-check/badge.svg)](https://github.com/yihui/mime/actions)
[![CRAN release](https://www.r-pkg.org/badges/version/mime)](https://cran.r-project.org/package=mime)

This is an R package for mapping filename extensions to [MIME
types](https://en.wikipedia.org/wiki/Internet_media_type), based on the data
[derived](R/mime.R) from `/etc/mime.types`.

```r
# 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"
```