computed-value-stream

Writeable stream that emits an update event instead of writing

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.

npm install computed-value-stream
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' }