computed-value-stream

Writeable stream that emits an update event instead of writing

npm install computed-value-stream
2 downloads in the last week
4 downloads in the last month

computed-value-stream

Stability: 1 - Experimental

Stability as defined by Node.js

A writable stream with objectMode=true that emits update events instead of writing to the stream buffer. Additionally, it stores the latest object in a property called value.

Installation

npm install computed-value-stream

Usage

var ComputedValueStream = require('computed-value-stream');

var cps = new ComputedValueStream();

console.log(cps.value);
// -> undefined

cps.write({my: 'object'});
console.log(cps.value);
// -> { my: 'object' }

cps.on('update', function(updatedValue) {
  console.log('update:', updatedValue);
});

cps.write({another: 'thing'});
// -> update: { another : 'thing' }
npm loves you