I want to delete a file from Amazon S3 using Javascript. I have already uploaded the file using Javascript. Any ideas?
You can use the JS method from S3:
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./credentials-ehl.json');
var s3 = new AWS.S3();
var params = { Bucket: 'your bucket', Key: 'your object' };
s3.deleteObject(params, function(err, data) {
if (err) console.log(err, err.stack); // error
else console.log(); // deleted
});
Be aware that S3 never returns it the object has been deleted. You have to check it before or after with getobject, headobject, waitfor, etc