MagickBytes (magick_bytes v0.2.0)

A tiny library for inferring MIME types from magic bytes.

Link to this section Summary

Functions

Tries to infer the MIME type of the file at path from its magic bytes.

Link to this section Functions

@spec mime(path :: Path.t()) :: {:ok, String.t()} | {:error, atom()}

Tries to infer the MIME type of the file at path from its magic bytes.

examples

Examples

iex> MagickBytes.mime("./test/archives/my_gzip_file_disguised_as.txt")
{:ok, "application/gzip"}