diff --git a/load.ts b/load.ts index 06ab9bd..0f5d019 100644 --- a/load.ts +++ b/load.ts @@ -718,8 +718,13 @@ async function load() { "tt0258000", ]; + // Create the folder if it doesn't exist + const folderPath = './data/imdb'; + const imdbFolderExists = await fs.stat(folderPath).then(() => true).catch(() => false); + if(!imdbFolderExists) await fs.mkdir(folderPath); + for (const id of ids) { - const path = `./data/imdb/${id}.html`; + const path = `${folderPath}/${id}.html`; const exists = await fs .stat(path) .then(() => true)