Socket
Book a DemoInstallSign in
Socket

pedestrian

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pedestrian

Recursive directory walker for node

latest
Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
245
91.41%
Maintainers
2
Weekly downloads
 
Created
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

walk

FAQs

Package last updated on 18 Jan 2018

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