A through stream that stamps all incoming lines of data with a message and emits it back out
npm install stamp-stream
Usage is simple
var stamp = ;var stream = ;stream; // "hello world\n" is printedstream;stream;
You can make dynamic stamps as well by passing in a function instead
var lines = 0;var stream =;stream; // "0 first\n1 second\n2 third\n" is printedstream;streamstream;
Stamp-Stream can be useful to stamp output from an application with timestamp or similar.
Assume we have a file called
var stamp = ;processstdin;processstdin;
If we now call
node my-app.js | node stream.js all log messages from
my-app.js would be prefixed by a timestamp.