ivar v0.8.1 Ivar.Utilities

Ivar.Utilities is a collection of utility functions used for building requests

Summary

Functions

Returns the mime type for a given type

Functions

get_mime_type(type, atom)
get_mime_type(binary, atom) :: binary

Returns the mime type for a given type

Args

  • type - a binary including the mime extension or a custom mime type
  • :ext | :file - the atom :ext to look up an extension or :file to look up a file name

Type

  • mime extension - "jpg" would return "image/jpeg"
  • custom mime type - "custom/type" any input containing a / is considered a custom type

Usage

iex> Ivar.Utilities.get_mime_type("png", :ext)
"image/png"

iex> Ivar.Utilities.get_mime_type("custom/type", :ext)
"custom/type"

iex> Ivar.Utilities.get_mime_type("elixir.png", :file)
"image/png"