Closed phated closed 2 years ago
Talked with @mafintosh and it seems that this is the wrong way to get the finished state of the writable. It seems you should do something akin to:
let finished = false
const d = new Duplex({
read (cb) {
if (!finished) return cb()
... do normal push flow ...
cb()
},
final (cb) {
finished = true
d.push(...) // starts the flow
cb()
}
})
This PR introduces 2 tests:
Readable.from
is provided an empty array and the Duplex stream marks the writable side as endedReadable.from
is provided an empty array but the Duplex stream does not mark the writable side as endedI'm not sure why this inconsistency exists, but I'm trying to update to-through to use a Duplex stream instead of a Transform stream (to better handle backpressure) and this is the failing case in my test suite.