ReqS3 (req_s3 v0.1.1)

Req plugin for Amazon S3.

ReqS3 handles a custom s3:// url scheme that supports two endpoints:

s3://<bucket>        # list bucket items
s3://<bucket>/<item> # get item content

Summary

Functions

Runs the plugin.

Functions

Link to this function

attach(request)

Runs the plugin.

Examples

iex> req = Req.new() |> ReqS3.attach()
iex> Req.get!(req, url: "s3://ossci-datasets").body |> Enum.take(5)
[
  "mnist/",
  "mnist/t10k-images-idx3-ubyte.gz",
  "mnist/t10k-labels-idx1-ubyte.gz",
  "mnist/train-images-idx3-ubyte.gz",
  "mnist/train-labels-idx1-ubyte.gz"
]

iex> req = Req.new() |> ReqS3.attach()
iex> body = Req.get!(req, url: "s3://ossci-datasets/mnist/train-images-idx3-ubyte.gz").body
iex> <<_::32, n_images::32, n_rows::32, n_cols::32, _body::binary>> = body
iex> {n_images, n_rows, n_cols}
{60_000, 28, 28}