const params = {
Bucket: bucket_name,
Key: 'test.txt'
}
s3.headObject(params, function(err, data) {
console.log(data)
});
Output:
{
AcceptRanges: 'bytes',
LastModified: 2020-09-03T15:53:09.000Z,
ContentLength: 19,
ETag: '"cb4f442e395bcf0bec578533e171537c"',
VersionId: 'L.OyYlW2AOEcarfmoKlLUbAbOc8X45.',
ContentType: 'application/octet-stream',
Metadata: { 'custom-data': 'whatever', 'x-amz-meta-hello-world': 'data here' }
}