file_store v0.1.0 FileStore.Adapters.S3

Stores files using Amazon S3.

Dependencies

To use this adapter, you'll need to install the following dependencies:

def deps do
  [
    {:ex_aws_s3, "~> 2.0"},
    {:hackney, ">= 0.0.0"},
    {:sweet_xml, ">= 0.0.0"}
  ]
end

Configuration

  • bucket - The name of your S3 bucket. This option is required.

  • base_url - The base URL that should be used for generating the public URLs to your files.

  • ex_aws - A keyword list of options that can be used to configure ExAws.

Example

iex> store = FileStore.new(
...>   adapter: FileStore.Adapters.S3,
...>   bucket: "mybucket"
...> )
%FileStore{...}

iex> FileStore.write(store, "foo", "hello world")
:ok

iex> FileStore.read(store, "foo")
{:ok, "hello world"}