Use sys inherits
Also use events.EventEmitter instead of process.EventEmitter.
This commit is contained in:
parent
0fcc94525a
commit
145fac2b56
12
lib/fs.js
12
lib/fs.js
@ -1,3 +1,7 @@
|
|||||||
|
var
|
||||||
|
sys = require('sys'),
|
||||||
|
events = require('events');
|
||||||
|
|
||||||
exports.Stats = process.Stats;
|
exports.Stats = process.Stats;
|
||||||
|
|
||||||
process.Stats.prototype._checkModeProperty = function (property) {
|
process.Stats.prototype._checkModeProperty = function (property) {
|
||||||
@ -381,6 +385,8 @@ exports.createReadStream = function(path, options) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var FileReadStream = exports.FileReadStream = function(path, options) {
|
var FileReadStream = exports.FileReadStream = function(path, options) {
|
||||||
|
events.EventEmitter.call(this);
|
||||||
|
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.fd = null;
|
this.fd = null;
|
||||||
this.readable = true;
|
this.readable = true;
|
||||||
@ -463,13 +469,15 @@ var FileReadStream = exports.FileReadStream = function(path, options) {
|
|||||||
read();
|
read();
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
FileReadStream.prototype.__proto__ = process.EventEmitter.prototype;
|
sys.inherits(FileReadStream, events.EventEmitter);
|
||||||
|
|
||||||
exports.createWriteStream = function(path, options) {
|
exports.createWriteStream = function(path, options) {
|
||||||
return new FileWriteStream(path, options);
|
return new FileWriteStream(path, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
var FileWriteStream = exports.FileWriteStream = function(path, options) {
|
var FileWriteStream = exports.FileWriteStream = function(path, options) {
|
||||||
|
events.EventEmitter.call(this);
|
||||||
|
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.fd = null;
|
this.fd = null;
|
||||||
this.writeable = true;
|
this.writeable = true;
|
||||||
@ -564,4 +572,4 @@ var FileWriteStream = exports.FileWriteStream = function(path, options) {
|
|||||||
|
|
||||||
flush();
|
flush();
|
||||||
};
|
};
|
||||||
FileWriteStream.prototype.__proto__ = process.EventEmitter.prototype;
|
sys.inherits(FileWriteStream, events.EventEmitter);
|
Loading…
x
Reference in New Issue
Block a user