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

Copy Markdown View Source

An inert file attachment or pre-uploaded provider file reference.

from_path/2 is the only local-path entry point and reads immediately. Keeping the bytes in the value makes later adapter formatting, persistence, retries, and service restarts independent of the original filesystem path.

Summary

Functions

Creates an attachment from raw bytes without performing I/O.

Creates an inert reference to a file already uploaded to a provider.

Reads a trusted local file immediately into a data-backed attachment.

Types

t()

@type t() :: %Imp.Adapter.Types.File{
  data: term(),
  file_id: term(),
  filename: term(),
  metadata: term(),
  mime_type: term(),
  path: term(),
  url: term()
}

Functions

from_bytes(bytes, opts \\ [])

Creates an attachment from raw bytes without performing I/O.

from_file_id(file_id, opts \\ [])

Creates an inert reference to a file already uploaded to a provider.

from_path(path, opts \\ [])

Reads a trusted local file immediately into a data-backed attachment.