-
-
Save onepiecehung/c7e22a04cff511003bb27f75502fa7d9 to your computer and use it in GitHub Desktop.
delete object in S3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
var BUCKET = 'node-sdk-sample-7271'; | |
aws.config.loadFromPath(require('path').join(__dirname, './aws-config.json')); | |
var s3 = new aws.S3(); | |
var params = { | |
Bucket: 'node-sdk-sample-7271', | |
Delete: { // required | |
Objects: [ // required | |
{ | |
Key: 'foo.jpg' // required | |
}, | |
{ | |
Key: 'sample-image--10.jpg' | |
} | |
], | |
}, | |
}; | |
s3.deleteObjects(params, function(err, data) { | |
if (err) console.log(err, err.stack); // an error occurred | |
else console.log(data); // successful response | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment