Skip to content

Latest commit

 

History

History
91 lines (44 loc) · 1.55 KB

hackney_mimetypes.md

File metadata and controls

91 lines (44 loc) · 1.55 KB

Module hackney_mimetypes

Function Index

extension/1Transform an extension to a mimetype.
filename/1Return the mimetype for any file by looking at its extension.
mime_to_exts/1Return the list of extensions for a mimetype.

Function Details

extension/1


extension(Ext::binary()) -> binary()



Transform an extension to a mimetype

Example:

  1> mimetypes:extension(<<"c">>).
  <<"text/x-c">>

filename/1


filename(Path::file:filename_all()) -> binary()



Return the mimetype for any file by looking at its extension. Example:

  1> hackney_mimetypes:filename(<<"test.cpp">>).
  <<"text/x-c">>

mime_to_exts/1


mime_to_exts(Mimetype::binary()) -> [binary()]



Return the list of extensions for a mimetype. Example:

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