title: Node js excel export:Download file without creating a file
body: <p>I am trying to implement excel export in my application using <code>fast-csv</code>.</p>
  
  <p>Here is the flow for export</p>
  
  <p>1)Fetch data from DB.</p>
  
  <p>2)Prepare and download the excel</p>
  
  <pre><code>function export(req, res) {
    let path = "sample.csv";
  
    exportService.exportExcel(
      {
        path: path,
        data: data,
      },
      status =&gt; {
        res.download(path);
      },
    );
  }
  </code></pre>
  
  <p><strong>ExportService</strong></p>
  
  <pre><code>function exportExcel(params, callback) {
    csv.writeToPath(params.path, params.data, { headers: true }).on("finish", function() {
      console.log("done");
      callback(true);
    });
  }
  </code></pre>
  
  <p>This works fine however this method has a drawback it need to write to a file before download is there any way to avoid this temporary writing or delete the file after download from the folder</p>