Skip to content

Commit c6b8025

Browse files
committed
fix: ensure folderPath exists
1 parent 94b4dfd commit c6b8025

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

load.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,13 @@ async function load() {
718718
"tt0258000",
719719
];
720720

721+
// Create the folder if it doesn't exist
722+
const folderPath = './data/imdb';
723+
const imdbFolderExists = await fs.stat(folderPath).then(() => true).catch(() => false);
724+
if(!imdbFolderExists) await fs.mkdir(folderPath);
725+
721726
for (const id of ids) {
722-
const path = `./data/imdb/${id}.html`;
727+
const path = `${folderPath}/${id}.html`;
723728
const exists = await fs
724729
.stat(path)
725730
.then(() => true)

0 commit comments

Comments
 (0)