Socket
Socket
Sign inDemoInstall

@nodelib/fs.walk

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nodelib/fs.walk

A library for efficiently walking a directory recursively


Version published
Weekly downloads
38M
decreased by-1.85%
Maintainers
1
Weekly downloads
 
Created

What is @nodelib/fs.walk?

The @nodelib/fs.walk package is a Node.js library for efficiently walking a directory tree and listing all the files and directories within it. It provides a way to traverse the filesystem with various options for filtering and handling the results.

What are @nodelib/fs.walk's main functionalities?

Asynchronous directory walking

This feature allows you to walk through directories asynchronously, receiving a callback with the list of all entries (files and directories).

const { walk } = require('@nodelib/fs.walk');

walk('path/to/directory', (error, entries) => {
  if (error) {
    throw error;
  }

  for (const entry of entries) {
    console.log(entry.path);
  }
});

Synchronous directory walking

This feature provides a synchronous way to walk through directories, returning an array of all entries.

const { walkSync } = require('@nodelib/fs.walk');

const entries = walkSync('path/to/directory');
for (const entry of entries) {
  console.log(entry.path);
}

Stream-based directory walking

This feature allows you to walk through directories using a stream interface, which can be more efficient for handling large directories.

const { walkStream } = require('@nodelib/fs.walk');
const stream = walkStream('path/to/directory');

stream.on('data', (entry) => {
  console.log(entry.path);
});

stream.on('error', (error) => {
  throw error;
});

stream.on('end', () => {
  console.log('Finished walking the directory.');
});

Other packages similar to @nodelib/fs.walk

Keywords

FAQs

Package last updated on 12 May 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