Thread:がか/@comment-1915363-20170113160259/@comment-26154973-20170113170229

You can use a callback with http.get, it gives a response stream, so you can pipe it to unzip and then pipe it to a file, like so (parallel downloading) for (const id of ids) { const hash = crypto.createHash("md5").update(pre + id).digest("hex"); http.get(`${link}/i/${hash}.bin`, res =>       res.pipe(zlib.createUnzip).pipe(fs.createWriteStream(`${hash}.png`))    ); }