# glob-stream

> Readable streamx interface over anymatch.

Latest version **8.0.3** (published 2025-06-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install glob-stream
pnpm add glob-stream
yarn add glob-stream
bun add glob-stream
```

## Health

**Score 33/100 (F)** — status: maintenance-mode.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 8.0.3 |
| Published | 2025-06-01 |
| First published | 2013-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/glob-stream) |
| Module format | CommonJS |
| Node | >=10.13.0 |
| Dependencies | 8 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 181 |
| Author | Gulp Team |
| Maintainers | phated, yocontra |
| Keywords | glob, stream, gulp, readable, fs, files |

## Links

- npm: https://www.npmjs.com/package/glob-stream
- Repository: https://github.com/gulpjs/glob-stream
- Homepage: https://github.com/gulpjs/glob-stream#readme
- Issues: https://github.com/gulpjs/glob-stream/issues
- npm.io page: https://npm.io/package/glob-stream

## Dependencies (8)

- [fastq](https://npm.io/package/fastq.md) ^1.13.0
- [is-glob](https://npm.io/package/is-glob.md) ^4.0.3
- [streamx](https://npm.io/package/streamx.md) ^2.12.5
- [anymatch](https://npm.io/package/anymatch.md) ^3.1.3
- [glob-parent](https://npm.io/package/glob-parent.md) ^6.0.2
- [normalize-path](https://npm.io/package/normalize-path.md) ^3.0.0
- [is-negated-glob](https://npm.io/package/is-negated-glob.md) ^1.0.0
- [@gulpjs/to-absolute-glob](https://npm.io/package/@gulpjs/to-absolute-glob.md) ^4.0.0

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 8.0.3 (latest) — 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
- 4.1.1 — 2015-03-19
- … 36 more at https://npm.io/package/glob-stream/versions

## README

<p align="center">
  <a href="http://gulpjs.com">
    <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  </a>
</p>

# glob-stream

[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

[Readable streamx][streamx-url] interface over [anymatch][anymatch-url].

## Usage

```js
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`][allow-empty-url]).

## 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][anymatch-url].

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][glob-parent-url])

##### `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][picomatch-options-url].

## License

MIT

<!-- prettier-ignore-start -->
[anymatch-url]: https://github.com/micromatch/anymatch
[picomatch-options-url]: https://github.com/micromatch/picomatch#options
[glob-parent-url]: https://github.com/es128/glob-parent
[allow-empty-url]: #optionsallowempty
[streamx-url]: https://github.com/streamxorg/streamx#readable-stream

[downloads-image]: https://img.shields.io/npm/dm/glob-stream.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/glob-stream
[npm-image]: https://img.shields.io/npm/v/glob-stream.svg?style=flat-square

[ci-url]: https://github.com/gulpjs/glob-stream/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/glob-stream/dev.yml?style=flat-square

[coveralls-url]: https://coveralls.io/r/gulpjs/glob-stream
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/glob-stream/master.svg?style=flat-square
<!-- prettier-ignore-end -->

---
_Source: https://npm.io/package/glob-stream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
