scan-directory

[![NPM](https://nodei.co/npm/scan-directory.png?downloads=true&stars=true)](https://nodei.co/npm/scan-directory/)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
scan-directory
2.0.05 years ago6 years agoMinified + gzip package size for scan-directory in KB

Readme

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)