#Bun S3 client :: list objects in bucket

1 messages · Page 1 of 1 (latest)

versed rock
#

How does one use the ListObjects feature in the S3 API using Bun's new S3 client?

neat sequoia
#

not supported for the moment

exotic shuttle
#

this is a big need for me as well! Would look forward to see this implemented!

neat sequoia
#

the current implementation of AWS SignatureV4 in Bun is difficult to maintain which blocks other API implementations

dreamy lily
#

Yeah im using r2.. dont have list for some reason

dreamy lily
#

How do you know if a folder exists or not ? .. anyone know?

neat sequoia
#

There's no "folder" concept in S3

#

Imagine you have following Object names:

pictures/2024/summer.png
pictures/2023/summer.png

If you want to know if theres any Object with prefix pictures/2024/
You have to list Objects, then check for an Object name starting with pictures/2024/+

#

with ListObjects API which im working on, you will have an option called prefix which will filter Object keys by prefix
then in the returned response you can check if it returned any object or its empty

dreamy lily
#

Thought it created a folder in r2 in the bucket if prefix the folder/filename .. so i need list to find anything inside folder/ .. which doesnt exist right?

#

Yet i mean

neat sequoia
#

In this case folder/filename is an "empty" Object, or its "some virtual" folder handled by R2

#

in the S3 protocol there's no folder, but you can create an Object called pictures/2024 then created another Object pictures/2024/summer.png
Deleting pictures/2024 will not delete pictures/2024/summer.png

dreamy lily
#

If i simply do file.exists(/folder) it returns false .. if i do file.exists(/folder/filename) it return true.. i just wanted to know whether the prefix folder exists or not

neat sequoia
#

Im not familiar at all with R2, all im taling about is S3 protocol

dreamy lily
#

R2 is based on s3 i think same lib

neat sequoia
#

If you are talking about Bun's "lib" then all these is handled by the servers (R2, AWS S3)
Bun only parses and returns the response to you
If R2 says theres a folder but S3 says theres no folder it means R2 (CloudFlare server) isnt 100% S3 protocol compatible

dreamy lily
#

I think if we get list.. it will solve my problem..

#

Just list the /folder and go from there

neat sequoia
#

Yes it will

#

it will probably look something like this