From 8b117b0a2f7de45f05a192844f6625f9c6136308 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Wed, 28 Jan 2026 13:30:30 +0100 Subject: [PATCH] Updates --- scripts/upload.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/scripts/upload.ts b/scripts/upload.ts index 33ebf07..af92604 100644 --- a/scripts/upload.ts +++ b/scripts/upload.ts @@ -10,9 +10,29 @@ if (!filePath || !bucketDstName) { process.exit(1); } +const timeSeriesR2Name = bucketDstName + .split("/") + .map((p, i, arr) => { + if (arr.length - 1 !== i) return p; + const fileNameArr = p.split("."); + const fileName = fileNameArr.shift(); + + if (!fileName) return p; + + const newName = `${fileName}-${Date.now()}.${fileNameArr.filter((n) => Boolean(n.match(/./))).join(".")}`; + + return newName; + }) + .join("/"); + await s3UploadFile({ fileName: bucketDstName, filePath, }); +await s3UploadFile({ + fileName: timeSeriesR2Name, + filePath, +}); + console.log(`✅ Uploaded ${filePath}`);