فهرست منبع

Refactor to async iife.

Herby Vojčík 6 سال پیش
والد
کامیت
0ca1e2de32
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      index.js

+ 3 - 1
index.js

@@ -14,7 +14,9 @@ async function work () {
             const [, issue, year] = name.match(/(\d+)\/(\d+)/);
             console.info(`File ${year} / ${issue}: ${description}`);
             const xmlRaw = await fetch(url);
-            saves.push(xmlRaw.body.pipe(createWriteStream(`${year}.${issue}.xml`)));
+            saves.push((async () => {
+                await xmlRaw.body.pipe(createWriteStream(`${year}.${issue}.xml`));
+            })());
         }
         await Promise.all(saves);
     }