in transform stream transform method, `callback(null, null)` doesn't end stream but `this.push(null); callback()` does
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 122k
- Fork
- 37.3k
- Merge trung bình
- 4 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 283
Mô tả
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)
}
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu tại lib/internal/streams/transform.js ở các dòng 177-179 và so sánh hành vi callback của Transform được mô tả trong tài liệu với phần triển khai stream hiện có. Tái hiện sự khác biệt giữa callback(null, null) và this.push(null); callback(), sau đó kiểm tra các bài kiểm thử stream liên quan. Được xem là hoàn thành khi cả hai dạng đều kết thúc stream một cách nhất quán như mô tả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript
- Lĩnh vực
- stream-processing
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 76/100