Skip to content

benoitc/mimerl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mimerl

An Erlang library for MIME type handling.

Maps file extensions to MIME types and vice versa, based on the IANA Media Types registry.

Build

rebar3 compile

Usage

Get MIME type from extension:

1> mimerl:extension(<<"json">>).
<<"application/json">>

2> mimerl:extension(<<"html">>).
<<"text/html">>

Get MIME type from filename:

1> mimerl:filename(<<"index.html">>).
<<"text/html">>

2> mimerl:filename(<<"data.json">>).
<<"application/json">>

Get extensions for a MIME type:

1> mimerl:mime_to_exts(<<"text/plain">>).
[<<"txt">>,<<"text">>,<<"conf">>,<<"def">>,<<"list">>,<<"log">>,<<"in">>]

License

MIT

About

library to handle mimetypes

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors