diff options
author | 陈刚 <chengang07@meituan.com> | 2018-01-12 23:21:44 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-01-18 08:47:07 +0800 |
commit | 82bdf8fba2d3f197522e31ee49f3cc4f5f52bd53 (patch) | |
tree | 5585356bc1b08c7c70fd04af063d77f1bc7a57ae /test | |
parent | 5aa0f3ee169caf1eba9c3b013c1f757f73404029 (diff) | |
download | android-node-v8-82bdf8fba2d3f197522e31ee49f3cc4f5f52bd53.tar.gz android-node-v8-82bdf8fba2d3f197522e31ee49f3cc4f5f52bd53.tar.bz2 android-node-v8-82bdf8fba2d3f197522e31ee49f3cc4f5f52bd53.zip |
fs: fix options.end of fs.ReadStream()
Fixes: https://github.com/nodejs/node/issues/18116
PR-URL: https://github.com/nodejs/node/pull/18121
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Weijia Wang <starkwang@126.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-fs-read-stream.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js index 1b9cc4aa90..7fc7a0d56b 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -165,6 +165,20 @@ common.expectsError( } { + // Verify that end works when start is not specified. + const stream = new fs.createReadStream(rangeFile, { end: 1 }); + stream.data = ''; + + stream.on('data', function(chunk) { + stream.data += chunk; + }); + + stream.on('end', common.mustCall(function() { + assert.strictEqual('xy', stream.data); + })); +} + +{ // pause and then resume immediately. const pauseRes = fs.createReadStream(rangeFile); pauseRes.pause(); |