|
|
@ -623,7 +623,7 @@ var ReadStream = fs.ReadStream = function(path, options) { |
|
|
|
this[key] = options[key]; |
|
|
|
} |
|
|
|
|
|
|
|
if (this.start || this.end) { |
|
|
|
if (this.start !== undefined || this.end !== undefined) { |
|
|
|
if (this.start === undefined || this.end === undefined) { |
|
|
|
this.emit('error', |
|
|
|
new Error('Both start and end are needed for range streaming.')); |
|
|
@ -671,7 +671,7 @@ ReadStream.prototype._read = function () { |
|
|
|
allocNewPool(); |
|
|
|
} |
|
|
|
|
|
|
|
if(this.start && this.firstRead) { |
|
|
|
if (this.start !== undefined && this.firstRead) { |
|
|
|
this.pos = this.start; |
|
|
|
this.firstRead = false; |
|
|
|
} |
|
|
@ -683,7 +683,7 @@ ReadStream.prototype._read = function () { |
|
|
|
var toRead = Math.min(pool.length - pool.used, this.bufferSize); |
|
|
|
var start = pool.used; |
|
|
|
|
|
|
|
if(this.pos) { |
|
|
|
if (this.pos !== undefined) { |
|
|
|
toRead = Math.min(this.end - this.pos + 1, toRead); |
|
|
|
} |
|
|
|
|
|
|
@ -721,7 +721,7 @@ ReadStream.prototype._read = function () { |
|
|
|
|
|
|
|
fs.read(self.fd, pool, pool.used, toRead, this.pos, afterRead); |
|
|
|
|
|
|
|
if(self.pos) { |
|
|
|
if (self.pos !== undefined) { |
|
|
|
self.pos += toRead; |
|
|
|
} |
|
|
|
pool.used += toRead; |
|
|
|