Updates
This commit is contained in:
parent
2a2258e890
commit
8b117b0a2f
@ -10,9 +10,29 @@ if (!filePath || !bucketDstName) {
|
|||||||
process.exit(1);
|
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({
|
await s3UploadFile({
|
||||||
fileName: bucketDstName,
|
fileName: bucketDstName,
|
||||||
filePath,
|
filePath,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await s3UploadFile({
|
||||||
|
fileName: timeSeriesR2Name,
|
||||||
|
filePath,
|
||||||
|
});
|
||||||
|
|
||||||
console.log(`✅ Uploaded ${filePath}`);
|
console.log(`✅ Uploaded ${filePath}`);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user