delete image in bucket aws s3 node js code example
Example: how to store and delete s3 image using node js
const s3 = new AWS.S3(
{ accessKeyId: IAM_USER_KEY, # Put your iam user key
secretAccessKey: IAM_USER_SECRET, # Put your iam user secret key
Bucket: BUCKET_NAME # Put your bucket name
}
);
s3.deleteObject({
Bucket: MY_BUCKET,
Key: 'some/subfolders/nameofthefile1.extension'
},function (err,data){})
s3.createBucket({
Bucket: BUCKET_NAME
}, function () {
s3.putObject(params, function (err, data) {});
});