Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upes.concat - if any stream is ended it doesn't work #41
Comments
added a commit
to manuelsantillan/event-stream
that referenced
this issue
Nov 23, 2013
This comment has been minimized.
This comment has been minimized.
|
There is no standand way to indicate that a stream has already ended, so it's unlikely this patch would work in general. How are you getting streams that have already ended? |
right9ctrl
closed this
Sep 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
manuelsantillan commentedNov 23, 2013
If passing an already ended stream to es.concat / es.merge, it won't work unless an "end" event is manually provoked for that stream.
A possible fix would be to check if there is a "ended" property in the stream object and increment the counter during stream registration:
es.merge = function (/streams.../) {
var toMerge = [].slice.call(arguments)
var stream = new Stream()
var endCount = 0
stream.writable = stream.readable = true
toMerge.forEach(function (e) {
})
stream.write = function (data) {
this.emit('data', data)
}
stream.destroy = function () {
merge.forEach(function (e) {
if(e.destroy) e.destroy()
})
}
return stream
}