javascript - how to handle error while extracing the zip file in node.js -


i trying upload zip file , have extract in server side , have handle error while extracting zip file.to extract trying this

var zip = new admzip(x);  zip.extractallto('target path'); 

the extractallto not contain call function ,if contain can handle err let me know how handle err while extracting zip file.

i creating 1 tmp folder , after upload file , keep uploaded file tmp folder , storing uploaded file original folder , take path store db(mongodb).after stored data got stored result in callback function within callback function have tried remove tmp folder not remove it.i have tired remove without data stored callback function working . mistake did.how resolve it.i have tried this

db.save({'filepath':'xxxxx'},function(err,data) {       if(data)      {         fs.rmdir('xxxx/xxxxx',function(err)        {              if(err)              {                 console.log('err')               }else              {                console.log('removed');              }          });      } }); 

i received in console err.

after looking in code adm-zip, way embed extraction in try {} catch statement:

var zip = new admzip(x);  try {      zip.extractallto('target path'); } catch ( e ) {      console.log( 'caught exception: ', e ); } 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -