Last active
November 10, 2016 19:55
-
-
Save mtibeica/5389437 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var stream = require('stream'); | |
var util = require('util'); | |
function MyStream() { stream.Writable.call(this); } | |
util.inherits(MyStream, stream.Writable); | |
MyStream.prototype._write = function (chunk, encoding, callback) { | |
console.log("_write " + chunk.length); | |
callback(); | |
} | |
var aStream = new MyStream(); | |
aStream.on('finish', function () { console.log('finish emitted'); }) | |
aStream.write('x'); | |
aStream.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this logs
i need to do extra processing (asynchronous) after all writes are done and before finish is emitted.