1
0
This commit is contained in:
2025-08-07 00:46:04 +02:00
parent 37e60616cd
commit 37a4618fa6

View File

@@ -121,9 +121,8 @@ async function clearDownloadsFolder() {
}
// Helper: get newest .xlsx file in downloads folder
function getNewestFile(dir, ext = '.xlsx') {
function getNewestFile(dir) {
const files = fs.readdirSync(dir)
.filter(f => f.endsWith(ext))
.map(f => ({
name: f,
time: fs.statSync(path.join(dir, f)).mtime.getTime()
@@ -133,7 +132,7 @@ async function clearDownloadsFolder() {
}
// Wait for the downloaded file
const downloadedFilePath = getNewestFile(downloadPath, '.xlsx');
const downloadedFilePath = getNewestFile(downloadPath);
if (!downloadedFilePath) {
throw new Error('No XLSX file found in download folder');
}