How to use the walkdir function in walkdir

To help you get started, we’ve selected a few walkdir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github depcheck / depcheck / src / check.js View on Github external
return new Promise((resolve) => {
    const promises = [];
    const finder = walkdir(dir, { no_recurse: true, follow_symlinks: true });

    finder.on('directory', (subdir) =>
      ignoreDirs.indexOf(path.basename(subdir)) === -1 && !isModule(subdir)
        ? promises.push(
            checkDirectory(
              subdir,
              rootDir,
              ignoreDirs,
              deps,
              parsers,
              detectors,
            ),
          )
        : null,
    );
github jysperm / elecpass / src / common / pass-store.js View on Github external
return new Promise( (resolve, reject) => {
      const files = [];

      const events = walk(passStorePath, {follow_symlinks: true}, function(filename, stat) {
        if (filename.endsWith('.git')) {
          this.ignore(filename);
        }

        if (stat.isFile()) {
          files.push(filename);
        }
      });

      events.on('end', () => {
        resolve(files);
      });

      events.on('error', (path, err) => {
        reject(err);
      });
github esy / esy / esy-install / src / lib / fs.js View on Github external
return new Promise((resolve, reject) => {
    const w = walkDir(dirname);
    w.on('path', (name, stat) => {
      if (ignore(name)) {
        w.ignore(name);
      } else if (stat.isFile()) {
        const mtime = Math.floor(stat.mtime.getTime() / 1000);
        if (mtime > maxMtime) {
          maxMtime = mtime;
        }
      }
    });
    w.on('end', () => {
      resolve(maxMtime);
    });
    w.on('error', error => {
      reject(error);
    });

walkdir

Find files simply. Walks a directory tree emitting events based on what it finds. Presents a familiar callback/emitter/a+sync interface. Walk a tree of any depth.

MIT
Latest version published 5 years ago

Package Health Score

73 / 100
Full package analysis