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