Aws-sdk-js: Feature request: listObjects with metadata

Created on 13 Oct 2016  路  5Comments  路  Source: aws/aws-sdk-js

Yes, I already have a <ExposeHeader>x-amz-meta-foo</ExposeHeader> set in my bucket's CORS, but the way to see the metadata seems to by requesting the object directly.

I'm looking for the most efficient way to list my objects with additional meta data, that I'm using to track its processing.

service-api

Most helpful comment

Here's a gist with a recursive function to retrieve all listObjects with metadata or without.
I would really like to see an option in AWS SDK for this issue, but until then I guess we'll call headObject for each object..

https://gist.github.com/mihaiserban/1f35d488405812f2bbd4b16e38e4afb5

All 5 comments

Hi @kaihendry
The listObjects operation does not send back x-amz-meta- headers even if you do specify the header to be exposed in your bucket's CORS configuration. First, if metadata were sent back in the header, there would be no way of knowing which object each metadata header is associated with. Second, if multiple objects contain the same name for a metadata header, two headers cannot have the same name.
Even if the SDK were to add a customization to retrieve each object's metadata, it could still only accomplish that by making a separate headObject request to every object in the bucket, which does not solve the efficiency issue you have.
If you are requesting that the S3 service attach object metadata in its listObjects response data (rather than as headers), it is beyond the SDK's control, so you can request this on the AWS Forums for S3: https://forums.aws.amazon.com/forum.jspa?forumID=24
Is that what you were looking for, or is there a specific feature you are requesting from the SDK itself?

Yes, I'm asking for object metadata to be in the response please. I don't have time to campaign on the forums, sorry.

Surprised that the metadata is not available in listObjects request. Calling headObject request for each item is way too costly

Here's a gist with a recursive function to retrieve all listObjects with metadata or without.
I would really like to see an option in AWS SDK for this issue, but until then I guess we'll call headObject for each object..

https://gist.github.com/mihaiserban/1f35d488405812f2bbd4b16e38e4afb5

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings