$ npm install scan-directory
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
.
scan-directory
is bundled for node 10.
For older node versions use scan-directory/cjs
entry point (no async/await)
© 2010 - cnpmjs.org x YWFE | Home | YWFE