| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5aa0f3e commit 82bdf8f
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2267,7 +2267,8 @@ function ReadStream(path, options) { | |||
| 2267 | 2267 | this.flags = options.flags === undefined ? 'r' : options.flags; | |
| 2268 | 2268 | this.mode = options.mode === undefined ? 0o666 : options.mode; | |
| 2269 | 2269 | ||
| 2270 | - this.start = options.start; | ||
| 2270 | + this.start = typeof this.fd !== 'number' && options.start === undefined ? | ||
| 2271 | + 0 : options.start; | ||
| 2271 | 2272 | this.end = options.end; | |
| 2272 | 2273 | this.autoClose = options.autoClose === undefined ? true : options.autoClose; | |
| 2273 | 2274 | this.pos = undefined; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,6 +164,20 @@ common.expectsError( | |||
| 164 | 164 | })); | |
| 165 | 165 | } | |
| 166 | 166 | ||
| 167 | + { | ||
| 168 | + // Verify that end works when start is not specified. | ||
| 169 | + const stream = new fs.createReadStream(rangeFile, { end: 1 }); | ||
| 170 | + stream.data = ''; | ||
| 171 | + | ||
| 172 | + stream.on('data', function(chunk) { | ||
| 173 | + stream.data += chunk; | ||
| 174 | + }); | ||
| 175 | + | ||
| 176 | + stream.on('end', common.mustCall(function() { | ||
| 177 | + assert.strictEqual('xy', stream.data); | ||
| 178 | + })); | ||
| 179 | + } | ||
| 180 | + | ||
| 167 | 181 | { | |
| 168 | 182 | // pause and then resume immediately. | |
| 169 | 183 | const pauseRes = fs.createReadStream(rangeFile); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments