1.4.14 • Published 2 years ago

rereadable-stream v1.4.14

Weekly downloads
3,159
License
MIT
Repository
github
Last release
2 years ago

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:

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.

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

1.4.14

2 years ago

1.4.13

2 years ago

1.4.12

3 years ago

1.4.11

3 years ago

1.4.9

3 years ago

1.4.8

3 years ago

1.4.7

3 years ago

1.4.6

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.40

4 years ago

1.3.39

4 years ago

1.3.38

4 years ago

1.3.37

4 years ago

1.3.36

4 years ago

1.3.35

4 years ago

1.3.34

4 years ago

1.3.33

4 years ago

1.3.32

4 years ago

1.3.31

4 years ago

1.3.30

4 years ago

1.3.29

4 years ago

1.3.27

4 years ago

1.3.26

4 years ago

1.3.25

4 years ago

1.3.24

4 years ago

1.3.23

4 years ago

1.3.22

4 years ago

1.3.21

4 years ago

1.3.20

4 years ago

1.3.19

4 years ago

1.3.17

4 years ago

1.3.18

4 years ago

1.3.15

4 years ago

1.3.16

4 years ago

1.3.14

4 years ago

1.3.13

5 years ago

1.3.12

5 years ago

1.3.11

5 years ago

1.3.10

5 years ago

1.3.9

5 years ago

1.3.7

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

7 years ago