Storage.Blob (PhoenixContribStorage v0.1.0)

View Source

Schema for storing file metadata.

A Blob represents a file stored in the storage system, containing metadata like filename, content type, size, and storage location.

Summary

Functions

Checks if the blob represents an audio file.

Creates a new blob with the given attributes.

Finds a blob by its key.

Returns a human-readable representation of the file size.

Checks if the blob represents an image.

Purges blobs that are not attached to any records and older than the given duration.

Generates a URL for the blob.

Checks if the blob represents a video.

Functions

audio?(blob)

Checks if the blob represents an audio file.

create_and_upload!(file_data, attrs)

Creates a new blob with the given attributes.

find_by_key(key)

Finds a blob by its key.

human_size(size)

Returns a human-readable representation of the file size.

image?(blob)

Checks if the blob represents an image.

purge_unattached(older_than \\ %{days: 7})

Purges blobs that are not attached to any records and older than the given duration.

url(blob, opts \\ [])

Generates a URL for the blob.

video?(blob)

Checks if the blob represents a video.