# rereadable-stream

> A simple standards-based stream that can be read again from begining.

Latest version **1.4.14** (published 2022-08-21) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.14 |
| Published | 2022-08-21 |
| First published | 2017-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.6.0 |
| Dependencies | 0 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Scramjet |
| Maintainers | patu, scramjetorg, michalcz, stoq |

## Links

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

## Recent versions

- 1.4.14 (latest) — 2022-08-21
- 1.4.13 — 2021-12-10
- 1.4.12 — 2021-06-15
- 1.4.11 — 2021-05-19
- 1.4.9 — 2021-03-30
- 1.4.8 — 2021-03-29
- 1.4.7 — 2021-03-15
- 1.4.6 — 2021-02-02
- 1.4.5 — 2020-12-29
- 1.4.4 — 2020-12-11
- 1.4.3 — 2020-11-19
- 1.4.2 — 2020-10-28
- 1.4.1 — 2020-09-21
- 1.4.0 — 2020-09-21
- 1.3.40 — 2020-09-10
- … 43 more at https://npm.io/package/rereadable-stream/versions

## README

Re-Readable Stream
--------------------

The module exposes a Writable stream that you can replay at any given moment to any number of Writable outputs. Think of
it as a DVR feature for Node.js streams - one stream can start playing, but others may want to join in at any given
point in time and start reading from the begining.

Usage:

```js
const {ReReadable} = require("rereadable-stream");

let rereadable = fs.createReadStream("myfile")
    .pipe(new ReReadable(options));

srv.on("connection", (sock) => sock.pipe(rereadable.rewind()));
```

The module exposes a simple API on as an extension a standard Writable stream:

 * tail(count) - the last number of stream chunks will be pushed and then rest of it.
 * rewind() - this will stream from the begining of the buffer.

The options are:

 * length - 1 million items as standard
 * standard Writable stream options

If one of readable stream cannot cope with the speed of other streams `drop` events will be emitted to inform about it.

```js
rewound.on("drop", (count) => console.log(`dropped ${count} items`));
```

**Notice:** For version 1.0.0 only object streams are well tested. There's no reason why buffer stream should not work, but they won't
follow any sensible limits. This will be fixed in 1.2.0.

License
--------

See LICENSE (MIT).

For other licensing options please open an issue or contact the author at opensource (at) signicode.com

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