mirror of https://github.com/nodejs/node.git
Fix style; undefined reference bug
parent
ccf4afa256
commit
0e501f4ec5
14
lib/fs.js
14
lib/fs.js
|
@ -611,6 +611,8 @@ fs.createReadStream = function(path, options) {
|
|||
var ReadStream = fs.ReadStream = function(path, options) {
|
||||
events.EventEmitter.call(this);
|
||||
|
||||
var self = this;
|
||||
|
||||
this.path = path;
|
||||
this.fd = null;
|
||||
this.readable = true;
|
||||
|
@ -629,11 +631,12 @@ var ReadStream = fs.ReadStream = function(path, options) {
|
|||
this[key] = options[key];
|
||||
}
|
||||
|
||||
if(this.start || this.end) {
|
||||
if(this.start === undefined || this.end === undefined) {
|
||||
self.emit('error', new Error('Both start and end are needed for range streaming.'));
|
||||
} else if(this.start > this.end) {
|
||||
self.emit('error', new Error('start must be <= end'));
|
||||
if (this.start || this.end) {
|
||||
if (this.start === undefined || this.end === undefined) {
|
||||
this.emit('error',
|
||||
new Error('Both start and end are needed for range streaming.'));
|
||||
} else if (this.start > this.end) {
|
||||
this.emit('error', new Error('start must be <= end'));
|
||||
} else {
|
||||
this.firstRead = true;
|
||||
}
|
||||
|
@ -643,7 +646,6 @@ var ReadStream = fs.ReadStream = function(path, options) {
|
|||
return;
|
||||
}
|
||||
|
||||
var self = this;
|
||||
fs.open(this.path, this.flags, this.mode, function(err, fd) {
|
||||
if (err) {
|
||||
self.emit('error', err);
|
||||
|
|
Loading…
Reference in New Issue