Socket
Book a DemoInstallSign in
Socket

speedwalk

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

speedwalk

Walk an entire directory. Fast, simple, and asynchronous.

0.1.0
latest
Source
npmnpm
Version published
Weekly downloads
4
-20%
Maintainers
1
Weekly downloads
 
Created
Source

SpeedWalk

Install size

Walk an entire directory. Fast, simple, and asynchronous.

Features

Comparisons

Some comparisons between speedwalk and other Node.js libraries that provide tree-traversal solutions.

All tests were conducted on the same large directory. Each result is the average of each library's time to complete the walk with no custom functions provided.

PackageResult
speedwalk6.95ms
walk13826.33ms
@root/walk276.96ms
walker296.05ms

Usage

Import the walk function from the package. To call it, pass in a root directory and a callback function accepting a path and a dirent.

import { walk } from 'speedwalk';

await walk('./', (path, dirent) => {
    console.log('Path:', path);
    console.log('Is a file:', dirent.isFile());

    if (dirent.isDirectory() && dirent.name === 'node_modules') {
        // Tell "walk" to skip the traversal of a certain
        // directory by returning "true" from the callback.
        return true;
    }
});

The function will asynchronously walk through the root directory and all subsequent directories until the entire tree has been traversed.

Keywords

walk

FAQs

Package last updated on 24 Feb 2023

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.