How to know when file downloading is finished?
Use the callback in the download api:
res.download(filePath, req.param('file'), function(err){
//CHECK FOR ERROR
fs.unlink(filePath);
});
res.download(filePath, req.param('file'), function(err){
//CHECK FOR ERROR
fs.unlink(filePath);
});