Explorar el Código

Refactor to async iife.

Herby Vojčík hace 6 años
padre
commit
0ca1e2de32
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  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);
     }