diff --git a/lib/fs.js b/lib/fs.js index 1d08a54051..52a7415adf 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -4,6 +4,7 @@ var events = require('events'); var binding = process.binding('fs'); var constants = process.binding('constants'); var fs = exports; +var Stream = require('stream').Stream; var kMinPoolSpace = 128; var kPoolSize = 40 * 1024; @@ -606,7 +607,7 @@ fs.createReadStream = function(path, options) { var ReadStream = fs.ReadStream = function(path, options) { if (!(this instanceof ReadStream)) return new ReadStream(path, options); - events.EventEmitter.call(this); + Stream.call(this); var self = this; @@ -657,7 +658,7 @@ var ReadStream = fs.ReadStream = function(path, options) { self._read(); }); }; -util.inherits(ReadStream, events.EventEmitter); +util.inherits(ReadStream, Stream); fs.FileReadStream = fs.ReadStream; // support the legacy name @@ -797,7 +798,7 @@ fs.createWriteStream = function(path, options) { var WriteStream = fs.WriteStream = function(path, options) { if (!(this instanceof WriteStream)) return new WriteStream(path, options); - events.EventEmitter.call(this); + Stream.call(this); this.path = path; this.fd = null; @@ -824,7 +825,7 @@ var WriteStream = fs.WriteStream = function(path, options) { this.flush(); } }; -util.inherits(WriteStream, events.EventEmitter); +util.inherits(WriteStream, Stream); fs.FileWriteStream = fs.WriteStream; // support the legacy name