diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index c549105e15..191e9fedd7 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -121,6 +121,9 @@ function Readable(options) { // legacy this.readable = true; + if (options && util.isFunction(options.read)) + this._read = options.read; + Stream.call(this); } diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index 923d31362c..7d99ad484e 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -110,6 +110,14 @@ function Transform(options) { // sync guard flag. this._readableState.sync = false; + if (options) { + if (util.isFunction(options.transform)) + this._transform = options.transform; + + if (util.isFunction(options.flush)) + this._flush = options.flush; + } + this.once('prefinish', function() { if (util.isFunction(this._flush)) this._flush(function(er) { diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 45152845e1..111de41450 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -159,6 +159,14 @@ function Writable(options) { // legacy. this.writable = true; + if (options) { + if (util.isFunction(options.write)) + this._write = options.write; + + if (util.isFunction(options.writev)) + this._writev = options.writev; + } + Stream.call(this); }