const path = require('path')
const fs = require('fs');
const filePath1 = path.join
(
__dirname,
"..",
"public",
"exports",
"csv-"+ req.user.ecode + " history" + ".csv"
)
fs.writeFile(filePath1,csv,function(err){
if(err){
console.log('fs writeFile error:' + err)
return res.status(500).json({ err })
}else{
setTimeout(function()
{
fs.unlinkSync(filePath1)
},40000)
res.download(filePath1, function(err){
console.log(err);
})
}
})
am getting the following output in my console with csv and error as follows.. Date :,Feb-14-2020 Strategy,Corporate Goal,Project Name,Weightage,Responsibility,Target Date Financial,EBIDTA@582%= 46.77cr INR,Project A,10,EM00875,Jul-25-2020 Financial,EBIDTA@582%= 46.77cr INR,Project C,90,EM00875,Feb-16-2020
Error: Request aborted
at onaborted (E:\KRA_5\abc_5_final - Copy\node_modules\express\lib\response.js:1025:15)
at Immediate._onImmediate (E:\KRA_5\abc_5_final - Copy\node_modules\express\lib\response.js:1067:9)
at processImmediate (internal/timers.js:439:21) {
code: 'ECONNABORTED'
}