Qpdf.Installer (qpdf v0.2.0)

Copy Markdown View Source

Manages finding or downloading and extracting the qpdf AppImage.

Summary

Functions

Returns the expected path to the AppRun executable.

Returns the version of the installed qpdf executable.

Returns the default qpdf version.

Detects the current OS and CPU architecture.

Finds or installs qpdf, returning installation failures as error tuples.

Ensures that the qpdf executable is available. Returns the path to the executable, downloading and installing it if not present.

Finds the configured or existing qpdf executable without attempting to download.

Downloads, verifies, and extracts the qpdf AppImage into priv/native or _build.

Returns the priv directory for the :qpdf application.

Returns the directory where the qpdf native files are stored. Uses _build/qpdf-<version> when running under Mix to keep priv/ in the source repository clean, and falls back to priv/native in releases for the default version. Set config :qpdf, storage_dir: "/path/to/cache" to use a custom base directory; each version is stored in its own qpdf-<version> subdirectory.

Returns the configured qpdf version.

Functions

app_run_path(version \\ nil)

Returns the expected path to the AppRun executable.

bin_version()

@spec bin_version() :: {:ok, String.t()} | :error

Returns the version of the installed qpdf executable.

Returns {:ok, version_string} on success or :error when the executable is not available or cannot be run.

default_version()

Returns the default qpdf version.

detect_target(os \\ nil, arch \\ nil)

Detects the current OS and CPU architecture.

ensure_executable()

@spec ensure_executable() :: {:ok, String.t()} | {:error, any()}

Finds or installs qpdf, returning installation failures as error tuples.

ensure_executable!()

@spec ensure_executable!() :: String.t()

Ensures that the qpdf executable is available. Returns the path to the executable, downloading and installing it if not present.

find_executable()

@spec find_executable() :: {:ok, String.t()} | {:error, :not_found}

Finds the configured or existing qpdf executable without attempting to download.

install(opts \\ [])

@spec install(keyword()) :: {:ok, String.t()} | {:error, any()}

Downloads, verifies, and extracts the qpdf AppImage into priv/native or _build.

Options include :version, :force, :url, and :sha256. The default release has a pinned SHA-256. Other releases require a trusted 64-character hex digest via :sha256 or the :appimage_sha256 application setting. Verification occurs before making the download executable. Existing installations are reused unless force: true is given.

priv_dir()

Returns the priv directory for the :qpdf application.

storage_dir(version \\ nil)

Returns the directory where the qpdf native files are stored. Uses _build/qpdf-<version> when running under Mix to keep priv/ in the source repository clean, and falls back to priv/native in releases for the default version. Set config :qpdf, storage_dir: "/path/to/cache" to use a custom base directory; each version is stored in its own qpdf-<version> subdirectory.

version()

Returns the configured qpdf version.