API Reference Storehouse v#0.1.0

Copy Markdown View Source

Modules

Files for Phoenix: a file checked by its bytes (Storehouse.Check), stored under a new, safe key through a store of the app's (Storehouse.Adapter: the local disk, S3, …), and served safely (Storehouse.Local.Plug).

A store of files: the local disk (Storehouse.Local), S3, another object store, a database. Name it in the config

The type of a file, from its bytes.

Files in records, with Ecto: a column of type Storehouse.Ecto.File (or a list of them), files put in a changeset with put_file/4, made permanent when the record is saved, and deleted once nothing has them.

An Ecto type for a stored file (Storehouse.File) in a record's column: a map (jsonb in PostgreSQL) of its key, URL, name, type, size, checksum, width and height. No table of files: the record has its file.

A stored file: what Storehouse.store/2 gives, and what an app keeps in its records (or a document's data) to show and serve it again.

The files of a LiveView upload, stored.

A LiveView upload writer (Phoenix.LiveView.UploadWriter) that streams each chunk on to the store as it comes, with no file on the app's disk: to S3 in the parts of a multipart upload, to the local disk in its place. Storehouse.Live.allow/3 with mode: :stream gives it to the upload.

A Storehouse.Adapter that keeps files in a directory on the local disk.

Serves the files of Storehouse.Local, and takes the ones a browser uploads straight to it, when the store signed the upload.

A lasting URL of your app for a file that is not public: it checks that the person may see the file, then redirects to a URL the store signs for a few minutes (Storehouse.signed_url/2). Keep this URL in your records and documents, not the signed one, which expires.

A Storehouse.Adapter for Amazon S3, and the stores that speak its API: Cloudflare R2, MinIO, Tigris, Backblaze B2, DigitalOcean Spaces, Google Cloud Storage's interoperability. With no dependency: it signs its requests itself (AWS Signature Version 4).