/ student-intifada / node_modules / readdir-glob /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[   ]LICENSE10 months ago 11K 
[TXT]README.md10 months ago4.1K595aea1 more query options + view options [كارل مبارك]
[   ]index.js10 months ago6.7K 
[   ]package.json10 months ago1.0Kafd0ccc remove unused [كارل مبارك]
README.md

Readdir-Glob

Build Status Coverage Status

Recursive version of fs.readdir wih stream API and glob filtering. Uses the minimatch library to do its matching.

Requires Node.js 10.0 or later.

Performances

Compared to glob, readdir-glob is memory efficient: no matter the file system size, or the number of returned files, the memory usage is constant.

The CPU cost is proportional to the number of files in root folder, minus the number files in options.skip folders.

Advice: For better performances use options.skip to restrict the search as much as possible.

Usage

Install with npm

npm i readdir-glob
const readdirGlob = require('readdir-glob');
const globber = readdirGlob('.', {pattern: '**/*.js'});
globber.on('match', match => {
    // m.relative: relative path of the matched file
    // m.absolute: absolute path of the matched file
    // m.stat: stat of the matched file (only if stat:true option is used)
});
globber.on('error', err => {
    console.error('fatal error', err);
});
globber.on('end', (m) => {
    console.log('done');
});

readdirGlob(root, [options])

Returns a EventEmitter reading given root recursively.

Properties

Events

Methods

Options

The following options apply only if pattern option is set, and are forwarded to minimatch:

References

Unit-test set is based on node-glob tests.

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80