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 0d40950Copy full SHA for 0d40950
lib/supplement/storages/s3.ex
@@ -5,6 +5,26 @@ 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
+ headers = Map.new!(headers)
14
+
15
+ {:ok,
16
+ %{
17
+ size: Map.fetch!(headers, "Content-Length"),
18
+ updated_at: Map.fetch!(headers, "Last-Modified"),
19
+ created_at: Map.fetch!(headers, "Date"),
20
+ mime_type: Map.fetch!(headers, "Content-Type")
21
+ }}
22
23
+ error ->
24
+ handle_error(error)
25
+ end
26
27
28
@impl Storage
29
def put(upload, opts \\ []) do
30
key = opts[:key] || Upload.name(upload)
0 commit comments