Tinkex.Files.Types (Tinkex v0.3.4)

View Source

Type helpers and guards for file upload inputs.

Summary

Types

file_content()

@type file_content() :: binary() | Path.t() | File.Stream.t() | iodata()

file_tuple()

@type file_tuple() ::
  {String.t() | nil, file_content()}
  | {String.t() | nil, file_content(), String.t() | nil}
  | {String.t() | nil, file_content(), String.t() | nil, headers()}

file_types()

@type file_types() :: file_content() | file_tuple()

header_kv()

@type header_kv() :: {binary(), binary()}

headers()

@type headers() :: %{optional(binary()) => binary()} | [header_kv()]

request_files()

@type request_files() ::
  %{optional(String.t()) => file_types()} | [{String.t(), file_types()}]

Functions

file_content?(content)

@spec file_content?(term()) :: boolean()

file_types?(value)

@spec file_types?(term()) :: boolean()