Skip to content

readable event,outputs are different between v9.11 and v10.14.2 #25158

Closed
@curry-wxj

Description

@curry-wxj

1.txt 内容为123456789,
代码:
const rs = fs.createReadStream(path.join(__dirname, './1.txt'), {
highWaterMark: 3,
encoding: 'utf8'
})
rs.on('readable', () => {
let ch = rs.read(1)
console.log('ch', ch);
})
9.11版本node 输出 ch 1(readable触发了1次)
10.14.2版本 输出 ch 1 ch 2 (readable触发了2次)
不太懂 readable 什么情况下会再次触发,

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions