I need to check if a file exists using AWS SDK. Here is what I\'m doing:
var params = { Bucket: config.get(\'s3bucket\'), Key: path }; s3.getSignedU
The simplest solution without try/catch block.
const exists = await s3 .headObject({ Bucket: S3_BUCKET_NAME, Key: s3Key, }) .promise() .then( () => true, err => { if (err.code === 'NotFound') { return false; } throw err; } );