Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

stream.read(0) should not trigger the end event if there is no underlying data #6634

@jonathanong

Description

@jonathanong

unless you want to undocument it, .read(0) for me is "start getting data from the underlying source but don't consume this stream yet". thus, it shouldn't emit end until .read(n) is called with anything but n === 0.

test case:

var stream = new (require('stream')).Readable
stream.on('end', function () { console.log('end')})
stream._read = function(){}
stream.push(null)
stream.read(0)
// `end` is emitted but should not
stream.read()
// now `end` should be emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions