scan-directory

2.0.0 • Public • Published

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)

Readme

Keywords

none

Package Sidebar

Install

npm i scan-directory

Weekly Downloads

4,353

Version

2.0.0

License

ISC

Unpacked Size

3.56 kB

Total Files

4

Last publish

Collaborators

  • kashey