View Source Infer.Doc (Infer v0.2.3)

Document 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 Microsoft Word Document (DOC) data.

Takes the binary file contents as arguments. Returns true if it's Microsoft Word Open XML Format Document (DOCX) data.

Takes the binary file contents as arguments. Returns true if it's an OpenDocument Presentation Document.

Takes the binary file contents as arguments. Returns true if it's an OpenDocument Spreadsheet Document.

Takes the binary file contents as arguments. Returns true if it's an OpenDocument Text Document.

Takes the binary file contents as arguments. Returns true if it's Microsoft Power Point Document (PPT) data.

Takes the binary file contents as arguments. Returns true if it's Microsoft PowerPoint Open XML Presentation (PPTX) data.

Takes the binary file contents as arguments. Returns true if it's Microsoft Excel (XLS) data.

Takes the binary file contents as arguments. Returns true if it's Microsoft Excel Open XML Format Spreadsheet (XLSX) data.

Link to this section Functions

Specs

doc?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's Microsoft Word Document (DOC) data.

examples

Examples

iex> binary = File.read!("test/docs/sample.doc")
iex> Infer.Doc.doc?(binary)
true

iex> binary = File.read!("test/docs/sample.docx")
iex> Infer.Doc.doc?(binary)
false

Specs

docx?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's Microsoft Word Open XML Format Document (DOCX) data.

examples

Examples

iex> binary = File.read!("test/docs/sample.docx")
iex> Infer.Doc.docx?(binary)
true

iex> binary = File.read!("test/docs/sample.xlsx")
iex> Infer.Doc.docx?(binary)
false

Specs

odp?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's an OpenDocument Presentation Document.

examples

Examples

iex> binary = File.read!("test/docs/sample.odp")
iex> Infer.Doc.odp?(binary)
true

iex> binary = File.read!("test/docs/sample.odp")
iex> Infer.Doc.odt?(binary)
false

Specs

ods?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's an OpenDocument Spreadsheet Document.

examples

Examples

iex> binary = File.read!("test/docs/sample.ods")
iex> Infer.Doc.ods?(binary)
true

iex> binary = File.read!("test/docs/sample.ods")
iex> Infer.Doc.odt?(binary)
false

Specs

odt?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's an OpenDocument Text Document.

examples

Examples

iex> binary = File.read!("test/docs/sample.odt")
iex> Infer.Doc.odt?(binary)
true

iex> binary = File.read!("test/docs/sample.odt")
iex> Infer.Doc.pptx?(binary)
false

Specs

ppt?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's Microsoft Power Point Document (PPT) data.

examples

Examples

iex> binary = File.read!("test/docs/sample.ppt")
iex> Infer.Doc.ppt?(binary)
true

iex> binary = File.read!("test/docs/sample.doc")
iex> Infer.Doc.ppt?(binary)
false

Specs

pptx?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's Microsoft PowerPoint Open XML Presentation (PPTX) data.

examples

Examples

iex> binary = File.read!("test/docs/sample.pptx")
iex> Infer.Doc.pptx?(binary)
true

iex> binary = File.read!("test/docs/sample.xlsx")
iex> Infer.Doc.pptx?(binary)
false

Specs

xls?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's Microsoft Excel (XLS) data.

examples

Examples

iex> binary = File.read!("test/docs/sample.xls")
iex> Infer.Doc.xls?(binary)
true

iex> binary = File.read!("test/docs/sample.doc")
iex> Infer.Doc.xls?(binary)
false

Specs

xlsx?(binary()) :: boolean()

Takes the binary file contents as arguments. Returns true if it's Microsoft Excel Open XML Format Spreadsheet (XLSX) data.

examples

Examples

iex> binary = File.read!("test/docs/sample.xlsx")
iex> Infer.Doc.xlsx?(binary)
true

iex> binary = File.read!("test/docs/sample.docx")
iex> Infer.Doc.xlsx?(binary)
false