From 145fac2b56a29270c798996db508a9fc6338c1f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisend=C3=B6rfer?= Date: Fri, 5 Mar 2010 19:24:20 +0100 Subject: [PATCH] Use sys inherits Also use events.EventEmitter instead of process.EventEmitter. --- lib/fs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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