node.js, fetch a zip file and unzip it to ram
<p>I need help, how to fetch a zip file and unzip it to memory, or maybe write it to harddisk.</p>

<p>sample url </p>

<pre><code>var http = require("http");
var fs = require("fs");
var url = "http://www.caltrain.com/Assets/GTFS/caltrain/Caltrain-GTFS.zip"
var file = fs.createWriteStream("./file.zip");

http.get(url, (res) =&gt; {
    var test = res.pipe(file);
    console.log("it's finished")
    console.log(test)
})
</code></pre>

<p>I am not sure how the asycnc-api works, does createWriteStream wait for the whole buffer? and how to write it to disk?</p>

<p>// I find a better solution after hours of googling, <a href="https://stackoverflow.com/questions/10359485/how-to-download-and-unzip-a-zip-file-in-memory-in-nodejs">How to download and unzip a zip file in memory in NodeJs?</a></p>