# Storehouse v0.1.0 - API Reference

## Modules

- Files
  - [Storehouse](Storehouse.md): 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`).
  - [Storehouse.Check](Storehouse.Check.md): The type of a file, from its bytes.
  - [Storehouse.File](Storehouse.File.md): 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.

- Stores
  - [Storehouse.Adapter](Storehouse.Adapter.md): A store of files: the local disk (`Storehouse.Local`), S3, another object
store, a database. Name it in the config
  - [Storehouse.Local](Storehouse.Local.md): A `Storehouse.Adapter` that keeps files in a directory on the local
disk.
  - [Storehouse.Local.Plug](Storehouse.Local.Plug.md): Serves the files of `Storehouse.Local`, and takes the ones a browser
uploads straight to it, when the store signed the upload.
  - [Storehouse.S3](Storehouse.S3.md): 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).

- Private files
  - [Storehouse.Redirect](Storehouse.Redirect.md): 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.

- LiveView
  - [Storehouse.Live](Storehouse.Live.md): The files of a LiveView upload, stored.
  - [Storehouse.Live.Writer](Storehouse.Live.Writer.md): 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.

- Ecto
  - [Storehouse.Ecto](Storehouse.Ecto.md): 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.
  - [Storehouse.Ecto.File](Storehouse.Ecto.File.md): 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.

