scan-directory
[![NPM](https://nodei.co/npm/scan-directory.png?downloads=true&stars=true)](https://nodei.co/npm/scan-directory/)
Last updated 7 years ago by kashey .
ISC · Original npm · Tarball · package.json
$ npm install scan-directory 
SYNC missed versions from official npm registry.

NPM

Blazing fast directory scan. Uses async/await underneath, doing all the stuff in async and parallel way.

#Usage

import scan, {forExt} from 'scan-directory';

const list = await scan(
   directory: string, 
   acceptFunction, 
   [rejectFunction=skipNodeModules]
);

For example

const list = await scan(
  __dirName,    // where 
  forExt('js'), // what
  (fileName) => fileName.match(somePattern)) // what NOT

Where acceptFunction and rejectFunction - (fileName:string, stat) => boolean.

Node 8?

scan-directory is bundled for node 10.

For older node versions use scan-directory/cjs entry point (no async/await)

Current Tags

  • 2.0.0                                ...           latest (5 years ago)

2 Versions

  • 2.0.0                                ...           5 years ago
  • 1.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE