Peek into a fixed-size window on your streams, useful for logging and debugging.
PEEKSTREAM is a simple filtering stream that collects and buffers data inside a configured window as they're being streamed.
Useful for taking a peek at streaming logs or sampling data at intervals.
Also very useful for testing complex stream interactions.
npm install --save peekstream
var peek = require'peekstream'peek;
With your code like this:
You can peek into the stream by changing it to look like this (with child process piping sample):
var ps = peekchildstdout processstdout;setIntervalconsole.log"PIPE: " + pswindowtoString;1000;
PeekStream inherits from Stream and supports basic read and write operation.
In addition, PeekStream exports a
window property that is a
Buffer of the data that has
been filtered. When source stream emits
data the data is appended to the end of the
and any excess from the configured size is trimmed from the beginning of the buffer.
Creates and return a new PeekStream class instance with
SRC stream piped through it.
DEST stream is specified, the returned PeekStream will be piped
through the destination stream automatically as well.
DEST is also accessible from the resulting stream via the
destination property respectively.
PeekStream with specified windowing size (defaults to 1 kiB)
make testmake tdd # spins a loop
Compiles to JS with
Something to do:
pipe()works (but then how do we returned the PeekStream instance?)