Closed
Description
I have mentioned this in a couple of other threads before, I just wanted to get some thoughts and opinions really.
My suggestion is that we allow the _
methods, which need to be set on a stream, be passed in as part of the options on instantiation. e.g.
var stream = require('readable-stream')
var readable = new stream.Readable({
read(n) { }
})
var writable = new stream.Writable({
write(data, enc, next) { },
// edit - courtesy @calvinmetcalf
writev(chunks, next) { }
})
var duplex = new stream.Duplex({
read(n) { },
write(data, enc, next) { },
// edit - courtesy @calvinmetcalf
writev(chunks, next) { }
})
var transform = new stream.Transform({
transform(data, enc, next) { },
// edit - courtesy @calvinmetcalf
flush(done) { }
})
edit - functions in ES6 for readability
What do you think?