# `MpxjEx.Installer`
[🔗](https://github.com/rocket4ce/mpxj_ex/blob/v0.1.0/lib/mpxj_ex/installer.ex#L1)

Downloads MPXJ and keeps its jars in a local directory.

MPXJ isn't bundled with this library. The first time it's needed, the
official distribution for the configured version is downloaded from the
[MPXJ releases](https://github.com/joniles/mpxj/releases), verified, and
only its jars are kept (about 30 MB).

## Configuration

    config :mpxj_ex,
      # MPXJ version to download
      version: "16.10.0",
      # Where the jars live. Defaults to a per-version directory in the
      # user cache dir. Can also be set with MPXJ_EX_JAR_DIR.
      jar_dir: "/opt/mpxj",
      # Download MPXJ on first use. Set to false in production and run
      # `mix mpxj_ex.install` at build time instead.
      auto_install: true

To use an MPXJ you installed yourself, point `jar_dir` at a directory
containing `mpxj.jar` and its dependencies.

# `ensure_installed`

```elixir
@spec ensure_installed() :: :ok | {:error, MpxjEx.Error.t()}
```

Makes sure MPXJ is installed, downloading it when `auto_install` is enabled.

# `install`

```elixir
@spec install(keyword()) :: :ok | {:error, MpxjEx.Error.t()}
```

Downloads MPXJ and extracts its jars into `jar_dir/0`, replacing any existing install.

## Options

  * `:version` - MPXJ version to install (defaults to `version/0`)
  * `:path` - directory to install into (defaults to `jar_dir/0`)

# `installed?`

```elixir
@spec installed?() :: boolean()
```

Returns true when MPXJ is available in `jar_dir/0`.

# `jar_dir`

```elixir
@spec jar_dir() :: Path.t()
```

The directory holding `mpxj.jar` and its dependencies.

# `version`

```elixir
@spec version() :: String.t()
```

The MPXJ version in use.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
