title: How to write xls file and stream to response in node js
body: <p>What I have tried is below:</p>
  
  <pre class="lang-js prettyprint-override"><code>exports.downloadListOfUsers = (req, res) =&gt; {
      let users = [{id:'',name:'',lastName:'',gender:''},{...},{...}]
      const XLSX = require('xlsx');
      let ws = XLSX.utils.aoa_to_sheet(users); //XLSZ.utils.json_to_sheet(users)
      let wb = XLSX.utils.book_new();
      let wbout = XLSX.write(wb, {bookType: 'xlsx', type: 'binary'});
      wbout.pipe(res)
  }
  </code></pre>
  
  <p>After sending it to the client, the response status is pending and it gets failed after some time. I have no idea what I am missing. Please guide me. Thanks.</p>