|
|
@ -643,7 +643,7 @@ var ReadStream = fs.ReadStream = function(path, options) { |
|
|
|
} else if (this.start > this.end) { |
|
|
|
this.emit('error', new Error('start must be <= end')); |
|
|
|
} else { |
|
|
|
this.firstRead = true; |
|
|
|
this._firstRead = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -684,8 +684,9 @@ ReadStream.prototype._read = function () { |
|
|
|
allocNewPool(); |
|
|
|
} |
|
|
|
|
|
|
|
if (self.start !== undefined && self.firstRead) { |
|
|
|
if (self.start !== undefined && self._firstRead) { |
|
|
|
self.pos = self.start; |
|
|
|
self._firstRead = false; |
|
|
|
} |
|
|
|
|
|
|
|
// Grab another reference to the pool in the case that while we're in the
|
|
|
@ -731,10 +732,7 @@ ReadStream.prototype._read = function () { |
|
|
|
self._read(); |
|
|
|
} |
|
|
|
|
|
|
|
// pass null for position after we've seeked to the start of a range read
|
|
|
|
// always pass null on a non-range read
|
|
|
|
fs.read(self.fd, pool, pool.used, toRead, (self.firstRead ? self.pos : null), afterRead); |
|
|
|
self.firstRead = false; |
|
|
|
fs.read(self.fd, pool, pool.used, toRead, self.pos, afterRead); |
|
|
|
|
|
|
|
if (self.pos !== undefined) { |
|
|
|
self.pos += toRead; |
|
|
|