Aws-sdk-js: How to list objects in a date range?

Created on 19 Feb 2020  路  4Comments  路  Source: aws/aws-sdk-js

Confirm by changing [ ] to [x] below:

Describe the question
I'm looking to list all the objects stored in S3 bucket between two dates using aws s3 javascript sdk. According to ListObjects there is no parameter allowing to do that except a prefixor delimiter but in my case they are useless.
Is there any solution to do that or I have to get the returned data then filter them according to LastModified?

feature-request

Most helpful comment

The support for an additional param has to come from the service side, so I can open a ticket with them, but due to lack of requests for this particular feature it might sit at the backlog for a while.

All 4 comments

@slim-hmidi Thank-you for reaching out to us with your issue.

You are right, unfortunately we currently don't have any params to specify a range.
You can use the LastModified object returned from the list objects and write a customized function.
Please reach out if you need help writing that.

@ajredniwja Thanks for your answer. I did it manually.
Is there any intention to add a parameter or new api for that in the next version or there is no use case for that?

The support for an additional param has to come from the service side, so I can open a ticket with them, but due to lack of requests for this particular feature it might sit at the backlog for a while.

Interesting #3103 was opened as a feature request for this issue, but then it was closed as a duplicate.
I am adding my +1 to this request. Looping through all of the filenames and then filtering by date is very slow for large buckets. We use S3 for access logs and the number of files is huge after only 3 days.

Was this page helpful?
0 / 5 - 0 ratings