Wednesday, 12 April 2017

Async operation on each file with npm filewalker

I'm using Filewalker to traverse through a directory. However, for each file, I'd like to perform an asynchronous operation. How do I ensure that done is fired only after all the operations are complete?

filewalker('.')
  .on('file', function(p, s) {
    processAsync(p);
  })
  .on('done', function() {
    console.log('All files have been processed');
  })
.walk();



via Shrihari

No comments:

Post a Comment