Infer.Archive (Infer v0.2.0) View Source

Archive 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 ar archive.

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

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

Takes the binary file contents as arguments. Returns true if it's a Google Chrome Extension.

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

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

Takes the binary file contents as arguments. Returns true if it's a eot octet stream.

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

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

Takes the binary file contents as arguments. Returns true if it's a MSI windows installer archive.

Takes the binary file contents as arguments. Returns true if it's a Nintendo NES ROM.

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

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

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

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

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

Takes the binary file contents as arguments. Returns true if it's a 7z archive.

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

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

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

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

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

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

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

Link to this section Functions

Specs

ar?(binary()) :: boolean()

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

Specs

bz2?(binary()) :: boolean()

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

Specs

cab?(binary()) :: boolean()

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

Specs

crx?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a Google Chrome Extension.

Specs

dcm?(binary()) :: boolean()

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

Specs

deb?(binary()) :: boolean()

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

Specs

eot?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a eot octet stream.

See Infer.Book.epub?/1.

Specs

gz?(binary()) :: boolean()

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

Specs

lz?(binary()) :: boolean()

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

Specs

msi?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a MSI windows installer archive.

Specs

nes?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a Nintendo NES ROM.

Specs

pdf?(binary()) :: boolean()

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

Examples

iex> binary = File.read!("test/archives/sample.pdf")
iex> Infer.Archive.pdf?(binary)
true

Specs

ps?(binary()) :: boolean()

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

Specs

rar?(binary()) :: boolean()

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

Specs

rpm?(binary()) :: boolean()

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

Specs

rtf?(binary()) :: boolean()

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

Specs

sevenz?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's a 7z archive.

Specs

sqlite?(binary()) :: boolean()

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

Examples

iex> binary = File.read!("test/archives/sample.db")
iex> Infer.Archive.sqlite?(binary)
true

Specs

swf?(binary()) :: boolean()

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

Specs

tar?(binary()) :: boolean()

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

Specs

xz?(binary()) :: boolean()

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

Specs

z?(binary()) :: boolean()

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

Specs

zip?(binary()) :: boolean()

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

See: https://en.wikipedia.org/wiki/List_of_file_signatures

Examples

iex> binary = File.read!("test/archives/sample.zip")
iex> Infer.Archive.zip?(binary)
true

Specs

zst?(binary()) :: boolean()

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

## Examples

iex> binary = File.read!("test/archives/sample.tar.zst")
iex> Infer.Archive.zst?(binary)
true