Clamex v0.1.0 Clamex View Source

Clamex is a thin wrapper for ClamAV.

Link to this section Summary

Functions

Check if file is safe

Perform file scan

Check if file is infected

Link to this section Functions

Link to this function safe?(path) View Source
safe?(Path.t) :: boolean

Check if file is safe

Examples

iex> Clamex.safe?("test/files/virus.txt")
false

iex> Clamex.safe?("test/files/safe.txt")
true
Link to this function scan(path) View Source
scan(Path.t) :: :ok | {:error, atom} | {:error, String.t}

Perform file scan

Examples

iex> Clamex.scan("test/files/virus.txt")
{:error, :virus_found}

iex> Clamex.scan("test/files/safe.txt")
:ok

Error reasons

  • :virus_found - file is infected
  • :cannot_access_file - file specified as path cannot be accessed
  • :scanner_not_available - scanner is not available at executable_path
  • :cannot_connect_to_clamd - ClamAV daemon is not running in background
  • any other error reported by the scanner will be returned as is (as String)
Link to this function virus?(path) View Source
virus?(Path.t) :: boolean

Check if file is infected

Examples

iex> Clamex.virus?("test/files/virus.txt")
true

iex> Clamex.virus?("test/files/safe.txt")
false