title: How to send a file res.send() along with some json data. The file must be downloaded on Postman side
body: <p>I have a excel file data and a callback with statuscode and message as (200 - mail sent)
  I want to send download excel file as well as send res.json the json data(200 - mail sent).</p>
  <p>I tried doing this</p>
  <pre><code>let ws = XLSX.utils.json_to_sheet(userData);
                          let wb = XLSX.utils.book_new();
                          XLSX.utils.book_append_sheet(wb, ws);
                          let userInfo = XLSX.write(wb, { type: 'buffer', bookType: 'xlsx', bookSST: false });
  </code></pre>
  <p>Then after sending the userInfo to mail, i'm  sending callback like this</p>
  <p>callback({ &quot;statuscode&quot;: 200, &quot;message&quot;: &quot;Email sent successfully&quot;, &quot;file&quot;: userInfo });
  return;</p>
  <p>or i can change it to</p>
  <pre><code>// callback({&quot;status&quot;: {&quot;statuscode&quot;: 200, &quot;message&quot;: &quot;Email sent successfully&quot;},&quot;file&quot;: userInfo });
                                  // return;
  </code></pre>
  <p>Then in my controller, im sending it like this</p>
  <pre><code>router.post('/getUserInfoThroughExcel', function (req, res) {
      var data = req.body;
      data.files = req.files;
      excel_controller.getUserInfoThroughExcel(data, function (response) {
          res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
          res.setHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; + 'userData.xlsx');
          res.send(response.file)
      });
  });
  </code></pre>
  <p>Now how can i send the statuscode &amp; message with the file?</p>
  <p>Im able to download file in postman (Send and Download), But i want to see the json response also</p>
  <p><code>res.json(response)</code>  -&gt; The downloaded excel file from postman gets corrupted and no json data on response
  <code>res.send(response)</code>  -&gt; The downloaded excel file from postman gets corrupted and no json data on response
  <code>res.send(response.file)</code>  -&gt; The file is downloaded properly but json data must be included</p>