MpxjEx.Installer (MpxjEx v0.1.0)

Copy Markdown View Source

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, 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.

Summary

Functions

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

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

Returns true when MPXJ is available in jar_dir/0.

The directory holding mpxj.jar and its dependencies.

The MPXJ version in use.

Functions

ensure_installed()

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

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

install(opts \\ [])

@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?()

@spec installed?() :: boolean()

Returns true when MPXJ is available in jar_dir/0.

jar_dir()

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

The directory holding mpxj.jar and its dependencies.

version()

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

The MPXJ version in use.