Infer.Book (Infer v0.1.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

is_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.is_epub(binary)
true

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

Specs

is_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.is_mobi(binary)
true

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