in transform stream transform method, `callback(null, null)` doesn't end stream but `this.push(null); callback()` does
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
Version
latest main branch
Platform
irrelevant
Subsystem
stream
What steps will reproduce the bug?
https://nodejs.org/api/stream.html#transform-transformchunk-encoding-callback
callback(null, null) doesn't end stream but this.push(null); callback() does
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
callback(null, null) and this.push(null); callback() have the same effect (the stream ends).
What do you see instead?
callback(null, null) is different from this.push(null); callback()
Additional information
https://github.com/nodejs/node/blob/main/lib/internal/streams/transform.js#L177-L179
Would it be possible to change this to the following?
if (val !== undefined) {
this.push(val)
}
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 lib/internal/streams/transform.js 的第 177-179 行开始,将文档中描述的 Transform 回调行为与现有的 stream 实现进行比较。复现 callback(null, null) 与 this.push(null); callback() 之间的差异,然后检查相关的 stream 测试。当两种形式都如描述所述一致地结束 stream 时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- stream-processing
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 冷清
- 描述清晰度
- 描述清楚
- 新手友好度
- 76/100