This commit is contained in:
Benjamin Toby 2026-01-28 13:30:30 +01:00
parent 2a2258e890
commit 8b117b0a2f

View File

@ -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}`);