sen
Elixir aws s3 response - how to get the “key” value?
I using Exaws to get my aws s3 folder directory.
response = ExAws.S3.list_objects(bucket_name, prefix: “img/pic/”,delimiter: “/”) |> ExAws.request(region: “xxxxx”)
I get the response like below. How can i get the “key” value?
Thanks.
{:ok,
%{
body: %{
common_prefixes: [],
contents: [
%{
e_tag: "\"d41d8ez98f00b204s9800998ecg2427e\"",
key: "img/pic/“,
last_modified: "2018-11-15T04:15:20.000Z",
owner: %{
display_name: “admin”,
id: "e9d42292cddfe3bf5bab7f1eacfdee6b5d3a64f4528e369c6dc239a13e87c410"
},
size: "0",
storage_class: "STANDARD"
},
%{
e_tag: "\"e2dajb48d4qf7862d257eaf6753b3439\””,
key: "img/pic/sample.svg",
last_modified: "2018-11-15T04:15:40.000Z",
owner: %{
display_name: “admin”,
id: "e9d42832cddfe3bf5qob7f1eacfdee6b5d3c64f4528e469c6dc339a13e23c410"
},
size: "1149",
storage_class: "STANDARD"
}
],
is_truncated: "false",
marker: "",
max_keys: "1000",
name: "s3-test",
next_marker: "",
prefix: "img/pic/“
},
headers: [
……..
],
status_code: 200
}}
Marked As Solved
joaquinalcerro
Try:
{:ok, response} = ExAws.S3.list_objects(bucket_name, prefix: “img/pic/”,delimiter: “/”) |> ExAws.request(region: “xxxxx”)
Enum.map(response.body.contents, fn( c ) → c.key end)
It should return a list with the keys.
Best regards
1
Last Post!
nowdev
Popular in Questions
Hello, how can I check the Phoenix version ?
Thanks !
New
Lets say I have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
I would like to know what is the best IDE for elixir development?
New
lets say i have a sample like
a = 20; b = 10;
if (a > b) do
{:ok, "a"}
end
if (a < b) do
{:ok, b}
end
if (a == b) do
{:ok, "equa...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
Hello everyone,
I try to use an Javascript Event Handler in my root.html.leex file.
Therefore I created a function in the app.js file: ...
New
Other popular topics
What is the proper way to load a module from a file in to IEX?
In the python world, doing something like this pretty standard:
from ....
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Hi All,
I set a environment variables in dev.exs , like below code.
when i start server, how can i set the ${enable} value?
thanks.
d...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









