@@ -72,11 +72,11 @@ RandomAccessHTTP.prototype.write = function (offset, buf, cb) {
72
72
73
73
RandomAccessHTTP . prototype . read = function ( offset , length , cb ) {
74
74
if ( ! this . opened ) return openAndRead ( this , offset , length , cb )
75
- if ( ! this . readable ) return cb ( new Error ( 'File is not readable' ) )
75
+ if ( ! this . readable ) return cb ( new Error ( 'URL is not readable' ) )
76
76
77
77
var self = this
78
78
79
- var range = `${ offset } -${ offset + length - 1 } `
79
+ var range = `${ offset } -${ offset + length - 1 } ` // 0 index'd
80
80
var reqOpts = xtend ( this . urlObj , {
81
81
method : 'GET' ,
82
82
agent : this . keepAliveAgent ,
@@ -100,9 +100,9 @@ RandomAccessHTTP.prototype.read = function (offset, length, cb) {
100
100
var expectedRange = `bytes ${ range } /${ self . length } `
101
101
if ( res . headers [ 'content-range' ] !== expectedRange ) return cb ( new Error ( 'Server returned unexpected range: ' + res . headers [ 'content-range' ] ) )
102
102
var concatStream = concat ( onBuf )
103
- var limitter = limitStream ( length + 1 )
103
+ var limiter = limitStream ( length + 1 )
104
104
105
- pump ( res , limitter , concatStream , function ( err ) {
105
+ pump ( res , limiter , concatStream , function ( err ) {
106
106
if ( err ) return cb ( new Error ( `problem while reading stream: ${ err } ` ) )
107
107
} )
108
108
}
0 commit comments