# mute-stream

> Bytes go in, but they don't come out (when muted).

Latest version **4.0.0** (published 2026-05-08) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 63/100 (C)** — status: active.

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2026-05-08 |
| First published | 2012-07-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | separate (@types/mute-stream) |
| Module format | CommonJS |
| Node | ^22.22.2 \|\| ^24.15.0 \|\| >=26.0.0 |
| Dependencies | 0 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 54 |
| Author | GitHub Inc. |
| Maintainers | saquibkhan, npm-cli-ops, reggi, owlstronaut |
| Keywords | mute, stream, pipe |

## Links

- npm: https://www.npmjs.com/package/mute-stream
- Repository: https://github.com/npm/mute-stream
- Homepage: https://github.com/npm/mute-stream#readme
- Issues: https://github.com/npm/mute-stream/issues
- npm.io page: https://npm.io/package/mute-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

- 4.0.0 (latest) — 2026-05-08
- 3.0.0 — 2025-10-22
- 2.0.0 — 2024-09-24
- 1.0.0 — 2022-12-13
- 0.0.8 — 2018-12-28
- 0.0.7 — 2017-01-03
- 0.0.6 — 2016-02-13
- 0.0.5 — 2015-05-20
- 0.0.4 — 2013-07-15
- 0.0.3 — 2012-08-15
- 0.0.2 — 2012-07-24
- 0.0.1 — 2012-07-24

## README

# mute-stream

Bytes go in, but they don't come out (when muted).

This is a basic pass-through stream, but when muted, the bytes are
silently dropped, rather than being passed through.

## Usage

```javascript
const MuteStream = require('mute-stream')

const ms = new MuteStream(options)

ms.pipe(process.stdout)
ms.write('foo') // writes 'foo' to stdout
ms.mute()
ms.write('bar') // does not write 'bar'
ms.unmute()
ms.write('baz') // writes 'baz' to stdout

// can also be used to mute incoming data
const ms = new MuteStream()
input.pipe(ms)

ms.on('data', function (c) {
  console.log('data: ' + c)
})

input.emit('data', 'foo') // logs 'foo'
ms.mute()
input.emit('data', 'bar') // does not log 'bar'
ms.unmute()
input.emit('data', 'baz') // logs 'baz'
```

## Options

All options are optional.

* `replace` Set to a string to replace each character with the
  specified string when muted.  (So you can show `****` instead of the
  password, for example.)

* `prompt` If you are using a replacement char, and also using a
  prompt with a readline stream (as for a `Password: *****` input),
  then specify what the prompt is so that backspace will work
  properly.  Otherwise, pressing backspace will overwrite the prompt
  with the replacement character, which is weird.

## ms.mute()

Set `muted` to `true`.  Turns `.write()` into a no-op.

## ms.unmute()

Set `muted` to `false`

## ms.isTTY

True if the pipe destination is a TTY, or if the incoming pipe source is
a TTY.

## Other stream methods...

The other standard readable and writable stream methods are all
available.  The MuteStream object acts as a facade to its pipe source
and destination.

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