generatePresignedUrls(s3Client, keys, bucket, prefix?, privateBucket?)
Generates pre-signed URLs for uploading objects to S3.
s3Client
: An instance of the S3 client generated by eithercreateS3Client
or@aws-sdk/client-s3
.keys
: An array of object keys to upload.bucket
: The S3 bucket name.prefix
: (Optional) Prefix for object keys.privateBucket
: (Optional) Whether the bucket is private. Default isfalse
.operation
: (Optional) Whether the URLs are for uploading or downloading. Default isupload
. For downloading, set todownload
.options
: (Optional) Options for the pre-signed URLs. Currently only supportsexpiresIn
in seconds. Default is3600
(1 hour).
const urls = await generatePresignedUrls(
s3Client,
keys,
bucket,
prefix,
privateBucket,
operation,
options
);