Infer.Book (Infer v0.2.0) View Source

Book type matchers based on the magic number

Link to this section Summary

Functions

Takes the binary file contents as arguments. Returns true if it's a epub.

Takes the binary file contents as arguments. Returns true if it's a mobi.

Link to this section Functions

Specs

epub?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a epub.

Examples

iex> binary = File.read!("test/books/sample.epub")
iex> Infer.Book.epub?(binary)
true

iex> binary = File.read!("test/books/sample.mobi")
iex> Infer.Book.epub?(binary)
false

Specs

mobi?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a mobi.

Examples

iex> binary = File.read!("test/books/sample.mobi")
iex> Infer.Book.mobi?(binary)
true

iex> binary = File.read!("test/books/sample.epub")
iex> Infer.Book.mobi?(binary)
false