Parcourir la source

Refactor to async iife.

Herby Vojčík il y a 6 ans
Parent
commit
0ca1e2de32
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  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);
     }