How do I delete all the versions of the S3 object using AWS Node.js SDK?
I have versioning enabled bucket and need to delete multiple objects and their versions. I am referring to this guide which lacks Node.js example. This is my current code which only works for non-versioned buckets:
import { DeleteObjectsCommand, S3Client } from '@aws-sdk/client-s3';
const client = new S3Client({ region: env.region });
const command = new DeleteObjectsCommand({
Bucket: env.bucket,
Delete: {
Objects: keys,
},
});
const result: DeleteObjectsCommandOutput = await client.send(command);
I cannot also seem to find proper documentation for it. There is one here but it expects versionId which I do not have; I have only list of object keys.
Any solution for this?