Tuesday, 4 April 2017

How to call a function after sent the response in node js

After download the Zip file I need to call another function to ProcessZip file. But am unable to trigger the function ProcessZipFile() after the .send():

app.get('/', function (req, res) {
  DownloadZipFile();
});


function DownloadZipFile() {

    var file = fs.createWriteStream('./tmp/student.tar.gz');

    s3.getObject(params
.on('httpData', function (chunk) {

    file.write(chunk);

   })
.on('httpDone', function () {

    file.end();

   })
.send();
   }

function ProcessZipFile() {
     //.....
}



via Sharan

No comments:

Post a Comment