glob-stream

Readable streamx interface over anymatch.

MIT 51 个版本
安装
npm install glob-stream
yarn add glob-stream
pnpm add glob-stream
bun add glob-stream
README

glob-stream

NPM version Downloads Build Status Coveralls Status

Readable streamx interface over anymatch.

Usage

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).

API

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

options.allowEmpty

Whether or not to error upon an empty singular glob.

Type: Boolean

Default: false (error upon no match)

options.dot

Whether or not to treat dotfiles as regular files. This is passed through to anymatch.

Type: Boolean

Default: false

options.cwd

The current working directory that the glob is resolved against.

Type: String

Default: process.cwd()

options.root

The root path that the glob is resolved against.

Type: String

Default: undefined (use the filesystem root)

options.base

The 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.cwdbase

Whether or not the cwd and base should be the same.

Type: Boolean

Default: false

options.uniqueBy

Filters 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'

other

Any glob-related options are documented in picomatch.

License

MIT

版本列表
8.0.3 2025-06-01
8.0.2 2024-04-08
8.0.1 2024-03-25
8.0.0 2023-04-23
7.0.0 2021-10-31
6.1.0 2017-02-25
6.0.0 2017-02-22
5.3.5 2016-09-07
5.3.4 2016-08-26
5.3.3 2016-08-23
5.3.2 2016-03-03
5.3.1 2015-12-21
5.3.0 2015-12-16
5.2.0 2015-11-05
5.0.0 2015-03-19
4.1.1 2015-03-19
4.1.0 2015-03-16
4.0.1 2015-01-26
4.0.0 2014-12-28
3.1.18 2014-12-03
3.1.17 2014-11-13
3.1.16 2014-11-13
3.1.15 2014-08-16
3.1.14 2014-07-10
3.1.13 2014-06-30
3.1.12 2014-06-11
3.1.11 2014-06-01
3.1.10 2014-06-01
3.1.9 2014-01-18
3.1.8 2014-01-18
3.1.7 2014-01-16
3.1.6 2014-01-16
3.1.5 2014-01-13
3.1.3 2014-01-08
3.1.2 2014-01-05
3.1.1 2014-01-04
3.1.0 2013-12-29
3.0.5 2013-12-28
3.0.4 2013-12-14
3.0.3 2013-12-13
3.0.2 2013-12-09
3.0.1 2013-12-08
3.0.0 2013-12-07
2.0.1 2013-12-07
2.0.0 2013-12-07
1.0.0 2013-12-07
0.2.0 2013-12-07
0.1.0 2013-10-25
0.0.3 2013-07-05
0.0.2 2013-07-05
0.0.1 2013-07-04