FalEx.Storage (fal_ex v0.1.0)
View SourceStorage client for handling file uploads and transformations.
Automatically uploads files to fal.ai storage and transforms input payloads to replace file references with URLs.
Summary
Functions
Creates a new storage client.
Transforms input data by uploading any file references.
Uploads a file to fal.ai storage.
Types
@type t() :: %FalEx.Storage{config: FalEx.Config.t()}
Functions
Creates a new storage client.
Transforms input data by uploading any file references.
Recursively processes the input, uploading any binary data or file paths and replacing them with URLs.
Examples
input = %{
prompt: "A cat",
image: File.read!("cat.jpg")
}
transformed = Storage.transform_input(storage, input)
# => %{prompt: "A cat", image: "https://fal.media/..."}
Uploads a file to fal.ai storage.
Parameters
data
- Binary file data or a file pathopts
- Upload options
Options
:file_name
- Name of the file:content_type
- MIME type of the file
Examples
{:ok, url} = Storage.upload(storage, File.read!("image.png"),
file_name: "image.png",
content_type: "image/png"
)