scan-directory
v2.0.0
Published
[![NPM](https://nodei.co/npm/scan-directory.png?downloads=true&stars=true)](https://nodei.co/npm/scan-directory/)
Downloads
15,049
Readme
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)