Imp.Adapter.Types.Image (Imp v0.5.0)

Copy Markdown View Source

An inert image value backed by a remote reference or in-memory data.

from_path/1 and from_url/2 perform explicit eager I/O and return a data-backed value. from_url/2 accepts only HTTP(S); callers must validate untrusted hosts against their own allowlist because redirects and private network destinations are otherwise reachable.

Summary

Functions

Reads a trusted local image immediately into an inert value.

Downloads an HTTP(S) image immediately into an inert value.

Types

t()

@type t() :: %Imp.Adapter.Types.Image{
  data: term(),
  metadata: term(),
  mime_type: term(),
  url: term()
}

Functions

from_path(path)

Reads a trusted local image immediately into an inert value.

from_url(url, opts \\ [])

Downloads an HTTP(S) image immediately into an inert value.

Options include :timeout in milliseconds (default 30_000). :request may inject an arity-2 transport for deterministic tests.