|
|
hace 2 años | |
|---|---|---|
| .. | ||
| LICENSE | hace 2 años | |
| README.md | hace 2 años | |
| index.js | hace 2 años | |
| package.json | hace 2 años | |
| readable.js | hace 2 años | |
A Readable Stream interface over node-glob.
var gs = require('glob-stream');
var readable = gs('./files/**/*.coffee', { /* options */ });
var writable = /* your WriteableStream */
readable.pipe(writable);
You can pass any combination of glob strings. One caveat is that you cannot only pass a negative glob, you must give it at least one positive glob so it knows where to start. If given a non-glob path (also referred to as a singular glob), only one file will be emitted. If given a singular glob and no files match, an error is emitted (see also options.allowEmpty).
globStream(globs, options)Takes a glob string or an array of glob strings as the first argument and an options object as the second. Returns a stream of objects that contain cwd, base and path properties.
options.allowEmptyWhether or not to error upon an empty singular glob.
Type: Boolean
Default: false (error upon no match)
options.dotWhether or not to treat dotfiles as regular files. This is passed through to node-glob.
Type: Boolean
Default: false
options.silentWhether or not to suppress warnings on stderr from node-glob. This is passed through to node-glob.
Type: Boolean
Default: true
options.cwdThe current working directory that the glob is resolved against.
Type: String
Default: process.cwd()
options.rootThe root path that the glob is resolved against.
Note: This is never passed to node-glob because it is pre-resolved against your paths.
Type: String
Default: undefined (use the filesystem root)
options.baseThe absolute segment of the glob path that isn't a glob. This value is attached to each glob object and is useful for relative pathing.
Type: String
Default: The absolute path segement before a glob starts (see glob-parent)
options.cwdbaseWhether or not the cwd and base should be the same.
Type: Boolean
Default: false
options.uniqueByFilters stream to remove duplicates based on the string property name or the result of function. When using a function, the function receives the streamed data (objects containing cwd, base, path properties) to compare against.
Type: String or Function
Default: 'path'
Any glob-related options are documented in node-glob. Those options are forwarded verbatim, with the exception of root and ignore. root is pre-resolved and ignore is joined with all negative globs.
var stream = gs(['./**/*.js', '!./node_modules/**/*']);
Globs are executed in order, so negations should follow positive globs. For example:
The following would not exclude any files:
gs(['!b*.js', '*.js'])
However, this would exclude all files that started with b:
gs(['*.js', '!b*.js'])
MIT