Search code examples
aws-sdk-js

AWS Javascript SDK: upload object with metadata


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?


Solution

  • 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-