Ver Fonte

Refactor to async iife.

Herby Vojčík há 6 anos atrás
pai
commit
0ca1e2de32
1 ficheiros alterados com 3 adições e 1 exclusões
  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);
     }