# noop-stream

> Create a readable Node.js stream that produces no data (or optionally blank data) or a writable stream that discards data

Latest version **1.0.0** (published 2021-10-14) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2021-10-14 |
| First published | 2019-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 50 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | stream, readable, writable, readablestream, writablestream, noop, empty, dev, null, devnull, blank, drain, test, testing, fixture |

## Links

- npm: https://www.npmjs.com/package/noop-stream
- Repository: https://github.com/sindresorhus/noop-stream
- Homepage: https://github.com/sindresorhus/noop-stream#readme
- Issues: https://github.com/sindresorhus/noop-stream/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/noop-stream

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2021-10-14
- 0.1.0 — 2019-05-26

## README

# noop-stream

> Create a readable Node.js stream that produces no data (or optionally blank data) or a writable stream that discards data

This can be useful for testing, fixtures, draining a stream, etc. [(Example)](https://github.com/sindresorhus/file-type/commit/7d14761b757912bccc464fc3fb86398f2a533999)

It's like `fs.createReadStream('/dev/null')` but cross-platform.

## Install

```sh
npm install noop-stream
```

## Usage

```js
import stream from 'stream';
import {readableNoopStream} from 'noop-stream';

stream.pipeline(readableNoopStream({size: 10}), process.stdout);
```

```js
import stream from 'stream';
import {writableNoopStream} from 'noop-stream';

stream.pipeline(process.stdin, writableNoopStream());
```

## API

### readableNoopStream(options?)

Create a readable Node.js stream that produces no data (or optionally blank data).

Options are passed to the [`stream.Readable` constructor](https://nodejs.org/api/stream.html#stream_new_stream_readable_options), except for the `read` option.

You can also specify a `size` option, which is the size in bytes to produce. By default, it's `0`. Set it to `Infinity` to make it produce data until you manually destroy the stream.

### writableNoopStream(options?)

Create a writable Node.js stream that discards received data.

Options are passed to the [`stream.Writable` constructor](https://nodejs.org/api/stream.html#stream_constructor_new_stream_writable_options), except for the `write` option.

## Related

- [dev-null-cli](https://github.com/sindresorhus/dev-null-cli) - Cross-platform `/dev/null`
- [random-bytes-readable-stream](https://github.com/sindresorhus/random-bytes-readable-stream) - Creates a readable stream producing cryptographically strong pseudo-random data

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