Whiff (whiff v0.1.0)

Copy Markdown View Source

Elixir wrapper around the Rust whiff crate.

Returns idiomatic {:ok, report} / {:error, %Whiff.Error{}} results where report is a string-keyed map conforming to schema whiff/1.

Examples

iex> is_binary(Whiff.schema_version())
true

Native identification/extraction is the default. Elixir extractors (Whiff.Extractor) and analyzers (Whiff.Analyzer) run in BEAM processes outside the NIF.

Summary

Functions

Extract a whiff/1 report from a filesystem path.

Extract from in-memory bytes.

Extract many paths with bounded concurrency.

Compact LLM projection for a path (Report::llm_view).

Report schema version (whiff/1).

Library version.

Types

report()

@type report() :: %{optional(String.t()) => term()}

result()

@type result() :: {:ok, report()} | {:error, Whiff.Error.t()}

Functions

extract(path, opts \\ [])

@spec extract(Path.t(), keyword()) :: result()

Extract a whiff/1 report from a filesystem path.

Options

Native: :profile, :hashes, :privacy, :only, :skip, :format, :provenance, :limits, :tokens (llm only).

Pipeline: :mode (:fallback | :augment | :override), :extractors, :analyzers, :strict, :plugin_timeout_ms, :override_fields.

extract!(path, opts \\ [])

@spec extract!(Path.t(), keyword()) :: report()

Same as extract/2 but raises Whiff.Error.

extract_binary(bytes, opts \\ [])

@spec extract_binary(binary(), keyword()) :: result()

Extract from in-memory bytes.

Pass name: (filename) to aid detection.

extract_binary!(bytes, opts \\ [])

@spec extract_binary!(binary(), keyword()) :: report()

Same as extract_binary/2 but raises Whiff.Error.

extract_many(paths, opts \\ [])

@spec extract_many([Path.t()], keyword()) ::
  {:ok, [{Path.t(), result()}]} | {:error, Whiff.Error.t()}

Extract many paths with bounded concurrency.

Returns a list of {path, result} in input order.

Options: :max_concurrency (default 4), :on_error (:collect | :halt). Other options are forwarded to extract/2.

llm(path, opts \\ [])

@spec llm(Path.t(), keyword()) :: result()

Compact LLM projection for a path (Report::llm_view).

Default token budget: 800 (override with tokens:).

llm!(path, opts \\ [])

@spec llm!(Path.t(), keyword()) :: report()

Same as llm/2 but raises Whiff.Error.

schema_version()

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

Report schema version (whiff/1).

version()

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

Library version.