FileStream.Storage behaviour (file_stream v0.3.0)

A behaviour for streaming files from storage.

Link to this section Summary

Callbacks

A callback to initialize a stream with the provided options.

A callback for Collectable.into/1.

Functions

Similar to from_uri/1 but raises a FileStream.Error if storage is not supported.

Determines the FileStream.Storage implementation based on a URI scheme.

Link to this section Types

@type t() :: module()

Link to this section Callbacks

@callback init(keyword()) :: any()

A callback to initialize a stream with the provided options.

A callback for Collectable.into/1.

Link to this callback

reduce(t, acc, reducer)

A callback for Enumerable.reduce/3.

Link to this section Functions

@spec from_uri!(URI.t()) :: t()

Similar to from_uri/1 but raises a FileStream.Error if storage is not supported.

@spec from_uri(URI.t()) :: {:ok, t()} | :error

Determines the FileStream.Storage implementation based on a URI scheme.

Returns {:ok, storage} on success or :error if storage is not supported.