xxxxxxxxxx
// Imports your configured client and any necessary S3 commands.
import { s3Client, DeleteObjectCommand } from "@aws-sdk/client-s3";
// Specifies a path within your bucket and the file to delete.
export const bucketParams = { Bucket: "example-bucket-name", Key: "example-file.txt" };
// Returns a list of objects in your specified path.
export const run = async () => {
try {
const data = await s3Client.send(new DeleteObjectCommand(bucketParams));
console.log("Success", data);
return data;
} catch (err) {
console.log("Error", err);
}
};
run();