walk_callback_mode.js 394 B

123456789101112131415
  1. var ndir = require('../');
  2. ndir.walk('./', function onDir(dirpath, files) {
  3. console.log(' * %s', dirpath);
  4. for (var i = 0, l = files.length; i < l; i++) {
  5. var info = files[i];
  6. if (info[1].isFile()) {
  7. console.log(' * %s', info[0]);
  8. }
  9. }
  10. }, function end() {
  11. console.log('walk end.');
  12. }, function error(err, errPath) {
  13. console.error('%s error: %s', errPath, err);
  14. });