title: How to download CSV file after creating using json2csv
body: <p>I am generating a CSV file in which my data is writing very well using <code>json2csv</code> node module.
  This is my code to create a csv file with my data.</p>
  
  <pre><code> Lead.find({ownerId:owner._id}, function(err, data){
                  if(err){res.json(err)}
                    else{
                      res.json(data);  
                        var fields = ['lead', 'salutation', 'fname','lname','title','email','mobile','rating','address','city','state','zcode','company','industry','empSize','lsource'];
                        var csv = json2csv({ data: data, fields: fields });
                        var path='./public/csv/file'+Date.now()+'.csv'; 
                         fs.writeFile(path, csv, function(err,data) {
                          if (err) {throw err;}
                          else{ 
                            console.log('file Created');
                           //I need to download above creating csv file here
                          }
                      }); 
                    }
  
                });
  </code></pre>
  
  <p>So, Now I want to know how can I download created CSV file after generate csv.
  I tried <code>res.setHeader('Content-disposition', 'attachment; filename=data.csv');
      res.set('Content-Type', 'text/csv');
      res.status(200).send(data);</code></p>
  
  <p>But its not working ...</p>
  
  <p>Please let me know how can I do it.</p>
  
  <p>Thanks</p>