That's very nice, for comparison backblaze b2 has a request rate limit of double digits before it st
That's very nice, for comparison backblaze b2 has a request rate limit of double digits before it starts giving 429 errors
allHeaders: true into the aws block as well, next to signQuery: true=]



allHeaders: trueawssignQuery: true=]const r2 = new AwsClient({
accessKeyId: env.CF_ACCESS_KEY_ID,
secretAccessKey: env.CF_ACCESS_KEY_SECRET,
})
const url = new URL(`https://${env.BUCKET_NAME}.${env.CF_ACCOUNT_ID}.r2.cloudflarestorage.com`)
url.pathname = obj.path
url.searchParams.set('X-Amz-Expires', `${60 * 60 * 24 * env.STRUCTURE_EXPIRY}`)
const _signed = await r2.sign(new Request(url, {
method: 'GET',
contentDisposition: `attachment; filename="${obj.name}"`, // <------------------------ Something like this?
}), { aws: { signQuery: true } })
const signed = _signed.urlnew Request(url, {
headers: {
'content-disposition': `attachment; filename="${obj.name}"`
}
})const g_pdf = new PutObjectCommand({
Bucket: "fristroop",
Body: pdf.path,
Key: `halodergisi/dergiler/${pdf.filename}`,
});
await storage.send(g_pdf); const g_banner = new PutObjectCommand({
Bucket: "fristroop",
Body: banner.path,
Key: `halodergisi/thumbnails/${banner.filename}`,
ContentEncoding: banner.mimetype
});export const uploadFile = async (dest, file) => {
const command = new PutObjectCommand({
Bucket: "fristroop",
Body: file.path,
Key: `halodergisi/${dest}/${file.filename}`,
ContentType: file.mimetype,
});
await storage.send(command);
return command;
};
// router.js
const cmd_banner = await uploadFile("thumbnails", banner);
const cmd_pdf = await uploadFile("dergiler", pdf);
const model = await magazineModel.create({
id: v4(),
title,
description,
catId,
timestamp: Date.now(),
thumbnail: cmd_banner.input.Key,
file: cmd_pdf.input.Key,
});