# Clamxir [![Build Status](](

ClamAV wrapper for elixir based on

This package depends of clamav installed on your system. Please refer to: [](

As recomendation, use the daemonize flag on the configs, in order to improve

## Installation

The package can be installed by adding `clamxir` to your list of dependencies in `mix.exs`:

def deps do
    {:clamxir, "~> 0.1.8"}

## Usage

Clamxir receive the configs on each public method, and based on the configs,
will perform their task.

The config file by default is the struct `%Clamxir{}`.  The default values of
the structure are:

  daemonize: false,
  stream: false,
  check: fase

daemonize is a flag to use one instance of the clamav instead of
the creation of new instances for each request.

  iex>{}, "/path/file")

stream will pass the argument --stream to clamdscan, this will help
to avoid permission issues. 

  iex>{stream: true}, "/path/file")

check flag will add validation of the scanner availability before try
to run it.

  iex>{check: true}, "/path/file")

## Integration with Phoenix

1.  Install as dependency

        {:clamxir, "~> 0.1.8"}
2.  Use in the controller action where the files are uploaded

      def upload(conn, params) do
        file = params["index"]["file"]
        # Requires to have clamavdscann to work
        case{daemonize: true}, file.path) do
          true -> 
            # Process the file and ... 
            |> put_flash(:info,  "Created successfully")
            |> redirect(to: "/") 
          false -> conn
            |> put_flash(:error,  "Virus!!")
           |> redirect(to: "/") 
For a working sample please refer to:

Docs can be found at [](

- Add Logger features