{"author":{"name":"Yann Armelin"},"name":"readdir-glob","description":"Recursive fs.readdir with streaming API and glob filtering.","version":"3.0.0","homepage":"https://github.com/Yqnn/node-readdir-glob","repository":{"type":"git","url":"git://github.com/Yqnn/node-readdir-glob.git"},"main":"./dist/index.js","funding":{"url":"https://github.com/sponsors/yqnn"},"exports":{"import":{"default":"./dist/index.mjs","types":"./dist/index.d.mts"},"require":{"default":"./dist/index.js","types":"./dist/index.d.mts"}},"types":"./dist/index.d.mts","dependencies":{"minimatch":"^10.2.2"},"devDependencies":{"@types/node":"^22.9.0","jasmine":"^6.0.0","mkdirp":"^2.1.6","nyc":"^17.1.0","rimraf":"^3.0.2","tick":"0.0.6","tsdown":"^0.4.0","typescript":"^5.4.4"},"keywords":["recursive","fs","stream","streams","readdir","filesystem","find","filter","glob"],"scripts":{"test-cov":"npx nyc --reporter=lcov --reporter=text-summary --reporter=html jasmine --config=jasmine.json","test":"jasmine --config=jasmine.json","test-regen":"TEST_REGEN=1 jasmine --config=jasmine.json","build":"rimraf dist && tsdown","bench":"bash scripts/benchmark.sh","profile":"bash scripts/profile.sh && cat profile.txt"},"license":"Apache-2.0","engines":{"node":">=18"},"_id":"readdir-glob@3.0.0","gitHead":"4bb379a5822bb419f9d08c21509f9f20d764acf1","bugs":{"url":"https://github.com/Yqnn/node-readdir-glob/issues"},"_nodeVersion":"22.13.0","_npmVersion":"11.0.0","dist":{"integrity":"sha512-AhNB2KgKeVJr16nK9LLZbJNWnYoT23ZrumNKFDebHBdkC8KHSqWo871JAUhoWC/RtjEVdqNMFpM6qrwRbaUqpw==","shasum":"a3545e0cef84d88c30fe44118d1a7e20496e9245","tarball":"http://registry-npm.ywwl.com/readdir-glob/download/readdir-glob-3.0.0.tgz","fileCount":10,"unpackedSize":73110,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEDCg2wo1vHEjFglz7rAd0hGIrjKSdWNwIUYMJtku6F3AiEA009JChBHjGB+KkxEAfqw+trBp6TKqkZF6+ptyTWanBM="}],"size":15091,"noattachment":false,"key":"/readdir-glob/-/readdir-glob-3.0.0.tgz"},"_npmUser":{"name":"yqnn","email":"ynn@free.fr"},"directories":{},"maintainers":[{"name":"yqnn","email":"ynn@free.fr"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/readdir-glob_3.0.0_1771885276225_0.5598607503805739"},"_hasShrinkwrap":false,"readme":"# Readdir-Glob\n![Build Status](https://github.com/Yqnn/node-readdir-glob/actions/workflows/test.yml/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/Yqnn/node-readdir-glob/badge.svg?branch=master)](https://coveralls.io/github/Yqnn/node-readdir-glob?branch=master)\n\nRecursive version of fs.readdir wih stream API and glob filtering.\nUses the `minimatch` library to do its matching.\n\nRequirements:\n- 1.x.x requires Node.js 10.0 or later.\n- 2.x.x requires Node.js 14.0 or later.\n- 3.x.x requires Node.js 18.0 or later.\n\n## Performances\n\nCompared to `glob`, `readdir-glob` is memory efficient: no matter the file system size, or the number of returned files, the memory usage is constant.\n\nThe CPU cost is proportional to the number of files in `root` folder, minus the number files in `options.skip` folders.\n\n**Advice**: For better performances use `options.skip` to restrict the search as much as possible.\n\n## Usage\n\nInstall with npm\n```\nnpm i readdir-glob\n```\n\n```javascript\n// CommonJS:\nconst readdirGlob = require('readdir-glob');\n// ESM:\nimport readdirGlob from 'readdir-glob';\n\nconst globber = readdirGlob('.', {pattern: '**/*.js'});\nglobber.on('match', match => {\n    // m.relative: relative path of the matched file\n    // m.absolute: absolute path of the matched file\n    // m.stat: stat of the matched file (only if stat:true option is used)\n});\nglobber.on('error', err => {\n    console.error('fatal error', err);\n});\nglobber.on('end', (m) => {\n    console.log('done');\n});\n```\n\n## readdirGlob(root, [options])\n\n* `root` `{String}` Path to be read recursively, *default*: `'.'`\n* `options` `{Object}` Options, *default*: `{}`\n\nReturns a EventEmitter reading given root recursively.\n\n### Properties\n\n* `options`: The options object passed in.\n* `paused`: Boolean which is set to true when calling `pause()`.\n* `aborted` Boolean which is set to true when calling `abort()`.  There is no way at this time to continue a glob search after aborting.\n\n### Events\n\n* `match`: Every time a match is found, this is emitted with the specific thing that matched.\n* `end`: When the matching is finished, this is emitted with all the matches found. \n* `error`: Emitted when an unexpected error is encountered.\n\n### Methods\n\n* `pause()`: Temporarily stop the search\n* `resume()`: Resume the search\n* `abort()`: Stop the search forever\n\n### Options\n\n* `pattern`: Glob pattern or Array of Glob patterns to match the found files with. A file has to match at least one of the provided patterns to be returned.\n* `ignore`: Glob pattern or Array of Glob patterns to exclude matches. If a file or a folder matches at least one of the provided patterns, it's not returned. It doesn't prevent files from folder content to be returned. Note: `ignore` patterns are *always* in `dot:true` mode.\n* `skip`: Glob pattern or Array of Glob patterns to exclude folders. If a folder matches one of the provided patterns, it's not returned, and it's not explored: this prevents any of its children to be returned. Note: `skip` patterns are *always* in `dot:true` mode.\n* `mark`: Add a `/` character to directory matches.\n* `stat`: Set to true to stat *all* results.  This reduces performance.\n* `silent`: When an unusual error is encountered when attempting to read a directory, a warning will be printed to stderr.  Set the `silent` option to true to suppress these warnings.\n* `nodir`: Do not match directories, only files.\n* `follow`: Follow symlinked directories. Note that requires to stat *all* results, and so reduces performance.\n\nThe following options apply only if `pattern` option is set, and are forwarded to `minimatch`:\n* `dot`: Allow `pattern` to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.\n* `noglobstar`: Disable `**` matching against multiple folder names.\n* `nocase`: Perform a case-insensitive match.  Note: on case-insensitive filesystems, non-magic patterns will match by default, since `stat` and `readdir` will not raise errors.\n* `matchBase`: Perform a basename-only match if the pattern does not  contain any slash characters.  That is, `*.js` would be treated as equivalent to `**/*.js`, matching all js files in all directories.\n\n\n## References\n\nUnit-test set is based on [node-glob](https://www.npmjs.com/package/glob) tests.\n","publish_time":1771885276374,"_cnpm_publish_time":1771885276374,"dist-tags":{"latest":"3.0.0"}}