Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options.end of fs.ReadStream does not work when options.start is undefined. #18116

Closed
MoonBall opened this issue Jan 12, 2018 · 0 comments
Closed

Comments

@MoonBall
Copy link
Member

MoonBall commented Jan 12, 2018

  • Version: v8.9.4
  • Platform: Darwin Kernel Version 16.7.0
  • Subsystem: fs

code is

const { ReadStream } = require('fs');

stream = new ReadStream('./text.txt', {
  // start: 0,
  end: 2,
});

stream.on('data', data => {
  console.log('on data:', data.toString());
});
stream.on('end', () => {
  console.log('end');
});

./text.txt is:

abcde

When options.start is 0, the output is

on data: abc
end

When ignoring options.start, the output is

on data: abcde
end

If it is a bug, I can attempt to fix it.

MoonBall pushed a commit to MoonBall/node that referenced this issue Jan 12, 2018
MoonBall pushed a commit to MoonBall/node that referenced this issue Jan 13, 2018
evanlucas pushed a commit that referenced this issue Jan 30, 2018
Fixes: #18116
PR-URL: #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>
MylesBorins pushed a commit that referenced this issue Feb 27, 2018
Fixes: #18116
PR-URL: #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>
MylesBorins pushed a commit that referenced this issue Feb 27, 2018
Fixes: #18116
PR-URL: #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>
MayaLekova pushed a commit to MayaLekova/node that referenced this issue May 8, 2018
Fixes: nodejs#18116
PR-URL: nodejs#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant