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.getSignedUrl('getObject', params, callback);
It works but the problem is that when the object doesn't exists, the callback (with arguments err and url) returns no error, and when I try to access the URL, it says "NoSuchObject".
Shouldn't this getSignedUrl
method return an error object when the object doesn't exists? How do I determine if the object exists? Do I really need to make a call on the returned URL?
The simplest solution without try/catch block.