import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { DeleteObjectCommand, S3Client } from "@aws-sdk/client-s3";
const s3 = new S3Client({ region: "us-east-1" });
const url = await getSignedUrl(
s3,
new DeleteObjectCommand({
Bucket: process.env.BUCKET_NAME,
Key: "path/to/object.txt",
}),
{ expiresIn: 3600 } // seconds
);
// The client can now issue a DELETE request to `url`.
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
import { DeleteObjectCommand, S3Client } from "@aws-sdk/client-s3";
const s3 = new S3Client({ region: "us-east-1" });
const url = await getSignedUrl(
s3,
new DeleteObjectCommand({
Bucket: process.env.BUCKET_NAME,
Key: "path/to/object.txt",
}),
{ expiresIn: 3600 } // seconds
);
// The client can now issue a DELETE request to `url`.