Infer.Text (Infer v0.1.1) View Source

Text 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 html.

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

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

Link to this section Functions

Specs

is_html(binary()) :: boolean()

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

See: https://mimesniff.spec.whatwg.org/

Examples

iex> Infer.Text.is_html("<!DOCTYPE html>")
true

iex> Infer.Text.is_html("     <BODY>")
true

iex> Infer.Text.is_html("<")
false

Specs

is_shell_script(binary()) :: boolean()

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

Specs

is_xml(binary()) :: boolean()

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

See: https://mimesniff.spec.whatwg.org/