Socket
Socket
Sign inDemoInstall

pedestrian

Package Overview
Dependencies
13
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pedestrian

Recursive directory walker for node


Version published
Weekly downloads
13
decreased by-43.48%
Maintainers
2
Install size
2.18 MB
Created
Weekly downloads
 

Readme

Source

Build Status downloads npm Code Climate Test Coverage dependencies

Pedestrian

A recursive file walker for node.js

Installation

npm install pedestrian --save

Usage

Synchronously or asynchronously walk a file tree and receive an array of files back.

API

walk(directory[, patterns])

Walk a file tree asynchronously. This function returns a promise.

const pedestrian = require('pedestrian');

pedestrian.walk('dir').then(files => {

}, err => {

});

Or to get only particular files, pass one or more glob patterns as the second argument.

pedestrian.walk('dir', '**/*.js').then(files => {

});

// or

pedestrian.walk('dir', ['*.js', '*.coffee']).then(files => {

});

Negative globs are also supported.

pedestrian.walk('dir', ['**/*.js', '!**/foo.js']).then(files => {

});
walkSync(directory[, patterns])

The api for walkSync is the same as for walk, but instead of returning a promise, it returns the array of files.

let files = pedestrian.walkSync('lib');

N.B.

Both the sync and async versions work with either absolute or relatives paths. Relative paths should be relative to the caller, rather than the current working directory. The files that pedestrian returns will always be absolute paths, however.

See minimatch for more on the kinds of patterns you can use.

Contributing

Please see the contribution guidelines.

Keywords

FAQs

Last updated on 18 Jan 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc