Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 3.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Readdir-Glob
  2. [![Build Status](https://travis-ci.com/Yqnn/node-readdir-glob.svg?branch=master)](https://travis-ci.com/Yqnn/node-readdir-glob) [![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)
  3. Recursive version of fs.readdir wih stream API and glob filtering.
  4. Uses the `minimatch` library to do its matching.
  5. ## Usage
  6. Install with npm
  7. ```
  8. npm i readdir-glob
  9. ```
  10. ```javascript
  11. const readdirGlob = require('readdir-glob');
  12. const globber = readdirGlob('.', {pattern: '**/*.js'});
  13. globber.on('match', match => {
  14. // m.relative: relative path of the matched file
  15. // m.absolute: absolute path of the matched file
  16. // m.stat: stat of the matched file (only if stat:true option is used)
  17. });
  18. globber.on('error', err => {
  19. console.error('fatal error', err);
  20. });
  21. globber.on('end', (m) => {
  22. console.log('done');
  23. });
  24. ```
  25. ## readdirGlob(root, [options])
  26. * `root` `{String}` Path to be read recursively, *default*: `'.'`
  27. * `options` `{Object}` Options, *default*: `{}`
  28. Returns a EventEmitter reading given root recursively.
  29. ### Properties
  30. * `options`: The options object passed in.
  31. * `paused`: Boolean which is set to true when calling `pause()`.
  32. * `aborted` Boolean which is set to true when calling `abort()`. There is no way at this time to continue a glob search after aborting.
  33. ### Events
  34. * `match`: Every time a match is found, this is emitted with the specific thing that matched.
  35. * `end`: When the matching is finished, this is emitted with all the matches found.
  36. * `error`: Emitted when an unexpected error is encountered.
  37. ### Methods
  38. * `pause()`: Temporarily stop the search
  39. * `resume()`: Resume the search
  40. * `abort()`: Stop the search forever
  41. ### Options
  42. * `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.
  43. * `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.
  44. * `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.
  45. * `mark`: Add a `/` character to directory matches.
  46. * `stat`: Set to true to stat *all* results. This reduces performance.
  47. * `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.
  48. * `nodir`: Do not match directories, only files.
  49. * `follow`: Follow symlinked directories. Note that requires to stat *all* results, and so reduces performance.
  50. The following options apply only if `pattern` option is set, and are forwarded to `minimatch`:
  51. * `dot`: Allow `pattern` to match filenames starting with a period, even if the pattern does not explicitly have a period in that spot.
  52. * `noglobstar`: Disable `**` matching against multiple folder names.
  53. * `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.
  54. * `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.
  55. ## References
  56. Unit-test set is based on [node-glob](https://www.npmjs.com/package/glob) tests.