title: How to make fs writeFile faster for an image?
body: <p>How can I make this faster? I am using node and fs library. This is the endpoint of a POST request that sends an fs.Readable stream of a jpg image. The code is starting to hang at just around the 800 kB mark. Eventually, I want to be able to save a video. Ideally, I want it to take less than ten seconds.</p>
  <pre><code>  var bufs = [];
    readStream.on('data', function(d){ bufs.push(d); });
    readStream.on('end', function(){
    var buf = Buffer.concat(bufs);
    console.log(buf);
    fs.writeFile(&quot;test.jpg&quot;, buf, ()=&gt;{console.log('hi')});
    });
  </code></pre>