New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

simple-fs-walker

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-fs-walker

Synchronously performs a deep walk through a given FS path.

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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.

FAQs

Package last updated on 30 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc