We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bfb7bc commit cf0c355Copy full SHA for cf0c355
lib/supplement/storages/s3.ex
@@ -5,6 +5,24 @@ defmodule Capsule.Storages.S3 do
5
6
alias ExAws.S3, as: Client
7
8
+ @impl Storage
9
+ def stat(id, opts \\ []) do
10
+ case Client.head_object(config(opts, :bucket), id)
11
+ |> ex_aws_module().request() do
12
+ {:ok, %{headers: headers}} ->
13
+ {:ok,
14
+ %{
15
+ size: Keyword.fetch!(headers, "Content-Length"),
16
+ updated_at: Keyword.fetch!(headers, "Last-Modified"),
17
+ created_at: Keyword.fetch!(headers, "Date"),
18
+ mime_type: Keyword.fetch!(headers, "Content-Type")
19
+ }}
20
+
21
+ error ->
22
+ handle_error(error)
23
+ end
24
25
26
@impl Storage
27
def put(upload, opts \\ []) do
28
key = opts[:key] || Upload.name(upload)
0 commit comments