Nevertheless! Party Metaphorically

    simple-fs-walker

    1.0.0 • Public • Published

    simple-fs-walker

    This module recursively walks through a given FS path, walking through all levels of files and directories in sorted order (JS's array-of-strings .sort() order), synchronously, applying your callback(subpath, stats) on every FS item (file or directory) found in the walk.

    For the per-item callback, subpath always contains '/' as a separator regardless of platform, and stats is just Node's normal fs.Stats object. If the callback returns true, the walk stops at that point.

    Example:

    const fsWalker = require('simple-fs-walker');
     
    fsWalker(process.cwd(), (subpath, stats) => {
      console.log('Walk:', subpath, stats.isFile(), stats.isDirectory());
     
      if (stats.isFile()) {
        const fileName = subpath.split('/').pop();
        if (fileName === 'lookingForThis.txt') {
          console.log('Found!');
          foundItAt = subpath;
          return true;
        }
      }
     
    });

    Versions:

    version 1.0.0 (2019-09-29) :

    First published version of simple-fs-walker.

    Keywords

    none

    Install

    npm i simple-fs-walker

    DownloadsWeekly Downloads

    3

    Version

    1.0.0

    License

    none

    Unpacked Size

    3.28 kB

    Total Files

    3

    Last publish

    Collaborators

    • wv-coder