Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Javascript SDK: upload object with metadata

Tags:

aws-sdk-js

Tye AWS.S3.ManagedUpload object allows you to upload an object specifying "tags", but I don't see any documentation for specifying meta data on an uploaded object. Is this possible? If so, how?

like image 594
Mitch Avatar asked Jul 24 '18 22:07

Mitch


1 Answers

Try with the following:

const params = {
  Metadata: {
    'my-key': 'some-value',
  },
}
s3.upload(params, function(err, data) {
  console.log(err, data);
});

Note that the SDK will add the prefix x-amz-meta-

like image 112
Alexander Vitanov Avatar answered Nov 07 '22 13:11

Alexander Vitanov