export const getUploadFileSignedURLFromS3 = async ({fileType, userInfo}: S3Upload) => {
const ex = fileType.split('/')[1];
const Key = `${userInfo}/${randomUUID()}.${ex}`;
const Conditions = [
["content-length-range", 1, MAX_UPLOAD_SIZE]
];
const s3Params = {
Bucket: process.env.AWS_S3_FILES_BUCKET,
Key,
Conditions,
ContentType: `${fileType}`
};
const command = new PutObjectCommand(s3Params);
const uploadUrl = await getSignedUrl(s3Client, command, { expiresIn: 3600, });
return { uploadUrl, key: Key };
}
export const getUploadFileSignedURLFromS3 = async ({fileType, userInfo}: S3Upload) => {
const ex = fileType.split('/')[1];
const Key = `${userInfo}/${randomUUID()}.${ex}`;
const Conditions = [
["content-length-range", 1, MAX_UPLOAD_SIZE]
];
const s3Params = {
Bucket: process.env.AWS_S3_FILES_BUCKET,
Key,
Conditions,
ContentType: `${fileType}`
};
const command = new PutObjectCommand(s3Params);
const uploadUrl = await getSignedUrl(s3Client, command, { expiresIn: 3600, });
return { uploadUrl, key: Key };
}