format_parser v1.0.0 FormatParser
FormatParser parses a binary file and extracts the format and some additional information from it. It can deal with Audio, Video, Fonts, Images and Documents.
Link to this section Summary
Functions
FormatParser.parse expects a binary file.
If the file is recognized then it will return a struct which contains all
information that has been extracted from the file.
If the file is not recognized then it will return {:error, "Unknown"}
Link to this section Functions
FormatParser.parse expects a binary file.
If the file is recognized then it will return a struct which contains all
information that has been extracted from the file.
If the file is not recognized then it will return {:error, "Unknown"}
.
Parameters
- binary: A binary file
Examples
iex> {:ok, file} = File.read("priv/test.jpg")
iex> FormatParser.parse(file)
%FormatParser.Image{format: :jpg, height_px: nil, nature: :image, width_px: nil}
iex> {:ok, file} = File.read("priv/test.html")
iex> FormatParser.parse(file)
{:error, "Unknown"}