View Source Uploadex.Storage behaviour (Uploadex v3.1.0)

Behaviour for a Storage implementation.

Summary

Callbacks

Deletes the file

Returns the path of a temporary file, that will be deleted after the configured amount of time.

Returns the file's URL

Stores the file

Types

@type file() :: map() | String.t()
@type opts() :: Keyword.t()
@type record() :: any()
@type status() :: :ok | :error

Callbacks

@callback delete(file(), opts()) :: :ok | {:error, any()}

Deletes the file

Link to this callback

get_temporary_file(file, t, opts)

View Source
@callback get_temporary_file(file(), String.t(), opts()) :: String.t()

Returns the path of a temporary file, that will be deleted after the configured amount of time.

@callback get_url(file(), opts()) :: {status(), String.t()}

Returns the file's URL

@callback store(file(), opts()) :: :ok | {:error, any()}

Stores the file