Skip to content

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

@MoonBall

Description

@MoonBall
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions