storage v0.2.0 Storage.Adapters.Local View Source

The Local adapter is used to store files locally in filesystem.

Configuration

config :storage, Storage.Adapters.Local
  root: "priv/files",
  host: [
    url: "http://localhost:4000",
    from: "/static"
  ]
  • root: defines where all the files will be placed in file system
  • host: data used in URL generation

    • url: is the url that will be prepended
    • from: is path in root: where all publicly served files are (e.g. you can configure this with Plug.Static)

Link to this section Summary

Functions

Deletes the file in given path

Generates path from list of scope and filename

Stores the file using the Storage.File struct and source path of the file

Returns URL of the file from given path

Link to this section Functions

Deletes the file in given path.

Callback implementation for Storage.Adapter.delete/1.

Generates path from list of scope and filename.

Used only if adapter needs to append part of path to file destination path, where it will be stored.

Callback implementation for Storage.Adapter.path/1.

Stores the file using the Storage.File struct and source path of the file.

Callback implementation for Storage.Adapter.put/2.

Returns URL of the file from given path.

Callback implementation for Storage.Adapter.url/1.