Skip to content

Instantly share code, notes, and snippets.

@Kuirak
Created May 27, 2014 16:10
Show Gist options
  • Save Kuirak/49d2e9058d1e779d0f9f to your computer and use it in GitHub Desktop.
Save Kuirak/49d2e9058d1e779d0f9f to your computer and use it in GitHub Desktop.
util.inherits(ConstantStream,stream.Readable);
function ConstantStream(constant){
stream.Readable.call(this,{objectMode:true});
this.constant =constant; //get count form Cache
}
ConstantStream.prototype._read = function(){
var value ={};
value.name ='constant';
value.data =this.constant;
this.push([value]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment