diff --git a/lib/fs.js b/lib/fs.js index 579199d93e..165ece8155 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1,3 +1,7 @@ +var + sys = require('sys'), + events = require('events'); + exports.Stats = process.Stats; process.Stats.prototype._checkModeProperty = function (property) { @@ -381,6 +385,8 @@ exports.createReadStream = function(path, options) { }; var FileReadStream = exports.FileReadStream = function(path, options) { + events.EventEmitter.call(this); + this.path = path; this.fd = null; this.readable = true; @@ -463,13 +469,15 @@ var FileReadStream = exports.FileReadStream = function(path, options) { read(); }; }; -FileReadStream.prototype.__proto__ = process.EventEmitter.prototype; +sys.inherits(FileReadStream, events.EventEmitter); exports.createWriteStream = function(path, options) { return new FileWriteStream(path, options); }; var FileWriteStream = exports.FileWriteStream = function(path, options) { + events.EventEmitter.call(this); + this.path = path; this.fd = null; this.writeable = true; @@ -564,4 +572,4 @@ var FileWriteStream = exports.FileWriteStream = function(path, options) { flush(); }; -FileWriteStream.prototype.__proto__ = process.EventEmitter.prototype; \ No newline at end of file +sys.inherits(FileWriteStream, events.EventEmitter); \ No newline at end of file