Guest User

Untitled

a guest
Jul 17th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var walk = require("./lib/walk.js");
  2.  
  3. var counter = 0;
  4. var dirs = 0;
  5. var files = 0;
  6.  
  7. var then = new Date().getTime();
  8.  
  9. process.argv.forEach(function(val, index, array) {
  10. if (index > 1) {
  11. var walker = walk(val);
  12. walker.on("directory", function (path, file, next) {
  13. dirs++;
  14. counter++;
  15. //console.log(path);
  16. next();
  17. });
  18. walker.on("file", function (path, file, next) {
  19. files++;
  20. counter++;
  21. //console.log(path + "/" + file.name);
  22. next();
  23. });
  24. walker.on("end", function() {
  25. var now = new Date().getTime();
  26. console.log("time:" + ((now-then)/1000).toFixed(2) + ",total:" + counter + ",dirs:" + dirs + ",files:" + files);
  27. });
  28. }
  29. });
Add Comment
Please, Sign In to add comment