AWS API: How to write code that checks whether a file exists in a specific bucket?

I'm using Amazon S3 API () and I want to write a code that checks whether a certain filename exists in a bucket. I didn't find this info in the API documentation.


ANSWERS:


The best method to check if an object exists is to call the headObject function. This is what the waitFor('objectExists', ...) method uses behind the scenes to check if an object exists.


You want the Head operation:

The HEAD operation retrieves metadata from an object without returning the object itself.

This is the closest thing to a 'contains' operation that fetches the minimum possible for determining object existence.



 MORE:


 ? Fatest way to retrieve S3 objects metadata (NodeJS API)
 ? Time to live for SimpleDB or DynamoDB
 ? Time to live for SimpleDB or DynamoDB
 ? Time to live for SimpleDB or DynamoDB
 ? Scaling MongoDB on EC2 or should I just switch to DynamoDB?
 ? Is Amazon SimpleDB more reliable/available than DynamoDB?
 ? Amazon SimpleDB or DynamoDB
 ? Time to live of a item in dynamodb
 ? AWS SimpleDB how to setup
 ? Sorting in Amazon SimpleDB not working