code: function traverse (root, dirs, collect, next) {
    const rootPath = path.join (root, ...dirs);
    fs.lstat (rootPath, (err0) => {
      if (err0) {
        next (err0);
      } else {
        fs.readdir (rootPath, (_, files) => {
          let pending = files.length;
          for (let file of files) {
            const filePath = path.join (root, ...dirs, file);
            fs.lstat (filePath, (err1, stats) => {
              if (err1) {
                next (err1);
              } else {
                if (stats.isDirectory ()) {
                  traverse (root, [...dirs, file], collect, err2 => {
                    if (err2) {
                      next (err2);
                    } else {
                      if (--pending === 0) {
                        next ();
                      }
                    }
                  });
                } else {
                  if (stats.isFile ()) {
                    collect (dirs, file, files);
                    if (--pending === 0) {
                      next ();
                    }
                  }
                }
              }
            });
          }
        });
      }
    });
  }
docs: ***************************************************************************