method
bun.S3Client.presign
path: string,
): string;
Generate a presigned URL that grants temporary access to a file, for uploads or downloads, without exposing credentials.
@param path
The path to the file in the bucket
@param options
Options for generating the presigned URL
@returns
A presigned URL string
// Download URL
const downloadUrl = bucket.presign("file.pdf", {
expiresIn: 3600 // 1 hour
});
// Upload URL
const uploadUrl = bucket.presign("uploads/image.jpg", {
method: "PUT",
expiresIn: 3600,
type: "image/jpeg",
acl: "public-read"
});
// Long-lived public URL
const publicUrl = bucket.presign("public/doc.pdf", {
expiresIn: 7 * 24 * 60 * 60, // 7 days
acl: "public-read"
});