-
Notifications
You must be signed in to change notification settings - Fork 0
How to use DeleteObjectCommand
Jun Yuan edited this page May 19, 2024
·
2 revisions
import { S3Client, DeleteObjectCommand } from '@aws-sdk/client-s3';// Create an S3 client service object
const s3Client = new S3Client({
region: process.env.BUCKET_REGION,
credentials: {
accessKeyId: process.env.ACCESS_KEY_ID,
secretAccessKey: process.env.SECRET_ACCESS_KEY
}
});
//Set the parameters
const params = {
Bucket: //Bucket Name,
Key: //Object Key
};
//Command to delete the object
const command = new DeleteObjectCommand(params);
await s3Client.send(command);