# hijack-stream

> Temporarily take over a readable stream

Latest version **2.0.1** (published 2024-05-10) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2024-05-10 |
| First published | 2021-04-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 19.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | orechova, himanshusinghs, c-buckingham, mongo-j, mabaasit, alexander_schroll, chuck.kalmanek, mongodb-js-user, rueckstiess, durran, lerouxb, fredtruman, mbroadst, hswolff, satyasinha, matt_d_rat, rhysm, tomhollander, alena.khineika, jeff-allen-mongo, mmarcon, jonathan.balsano, mongodb-build, jack.weir, stennie, mcasimir, kristina.stefano, jarjee, shaketbaby, devtoolsbot, addaleax, gribnoysup, mutukrish |
| Keywords | password, prompt, tty, ask |

## Links

- npm: https://www.npmjs.com/package/hijack-stream
- Repository: https://github.com/mongodb-js/hijack-stream
- Issues: https://github.com/mongodb-js/hijack-stream/issues
- npm.io page: https://npm.io/package/hijack-stream

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 2.0.1 (latest) — 2024-05-10
- 2.0.0 — 2024-05-10
- 1.0.0 — 2021-04-12

## README

# hijack-stream

Temporarily take over a readable stream.

```js
import hijackStream from 'hijack-stream';

const { restore } = hijackStream({
  input: process.stdin,
  ondata(chunk) { if (chunk.includes('done')) restore(); },
  onend(error) { if (error !== null) console.warn(error); }
})
```

## Why not use [`read`](https://www.npmjs.com/package/read) instead?

Because `read `does not work inside a Node.js REPL.

## LICENSE

Apache-2.0

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