Reputation: 144
Im trying to store images for a gallery website in s3 and store description / title information for that image in the s3 object tags. I am wondering if there is a way that I can get a list of the object names with their tags into angular? Or given an object name can I get the tags into angular?
Upvotes: 2
Views: 935
Reputation: 1857
Use the S3 metadata, here is the doc.
var params = { Bucket: "mybucket", Key: "myfile.txt" }; s3.headObject(params, function(err, data) { console.log(data.Metadata['x-amz-(nameofyourmetadata)']); });
UPDATE :
Don't forget to fix the CORS configuration of your bucket
<CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>HEAD</AllowedMethod> <AllowedHeader>*</AllowedHeader> <ExposeHeader>x-amz-meta-description</ExposeHeader> </CORSRule>
Upvotes: 1