Skip to main content

Classes & Interfaces

StorageSettings

interface StorageSettings
Configuration for object lifecycle and storage behavior.

Properties

NameTypeDescription
expiresInObjectExpirationThe expiration time for the stored files (images, videos, etc.). You can specify one of the enumerated values or a number of seconds.

StorageClient

interface StorageClient
File support for the client. This interface establishes the contract for uploading files to the server and transforming the input to replace file objects with URLs.

Properties

NameTypeDescription
upload(file: Blob, options?: UploadOptions) => Promise<string>Upload a file to the server. Returns the URL of the uploaded file.
transformInput(input: Record<string, any>) => Promise<Record<string, any>>Transform the input to replace file objects with URLs. This is used to transform the input before sending it to the server and ensures that the server receives URLs instead of file objects.

Functions

getExpirationDurationSeconds

function getExpirationDurationSeconds(lifecycle: StorageSettings): number | undefined
Converts an StorageSettings to the expiration duration in seconds.
ParameterTypeDescription
lifecycleStorageSettingsthe lifecycle preference
Returns: number | undefined

buildObjectLifecycleHeaders

function buildObjectLifecycleHeaders(lifecycle: StorageSettings | undefined): Record<string, string>
Builds the headers for the Object Lifecycle preference to be used in API requests. This is used by the queue and run APIs to control the lifecycle of generated objects.
ParameterTypeDescription
lifecycleStorageSettings | undefinedthe lifecycle preference
Returns: Record<string, string>

createStorageClient

function createStorageClient({ config, }: StorageClientDependencies): StorageClient
ParameterTypeDescription
{ config, }StorageClientDependencies-
Returns: StorageClient

Types

UploadOptions

type UploadOptions = {
  /**
   * Custom lifecycle configuration for the uploaded file.
   * This object will be sent as the X-Fal-Object-Lifecycle header.
   */
  lifecycle?: StorageSettings;
}
Options for uploading a file.