nodejs aws s3 bucket delete item 1

nodejs aws s3 bucket delete item

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

Here is what the above code is Doing:
1. Create a new AWS.S3 object.
2. Call the deleteObject method of the AWS.S3 object.
3. Pass the bucket name and object key as parameters to the deleteObject method.
4. Handle any errors or exceptions that occur.
5. Log a message to the console if the object was deleted successfully.

Similar Posts