Closed kevva closed 8 years ago
What streams? I'm torn. What's to say those broken streams doesn't silently break in other ways too. Working around brokenness is a slippery slope.
The one in my link above for example, https://github.com/lukeapage/pngjs#pngpack. It's a stream, though it don't have all the methods that a Readable
usually have, https://github.com/lukeapage/pngjs/blob/master/lib/packer-async.js.
I tried to extend it with the unpipe
method, but it failed due to some missing props on this
.
Hmm, that module seems to subclass Stream
itself and not a specific type. Didn't think Stream
itself was subclassable, nor what that actually achieves. I guess we could work around it here, but can you also open an issue about it on that module?
I dunno either. In my eyes it looks like an event emitter achieved by using the Stream
interface. Maybe it inherits some internal stream stuff too, I don't know. I'll open an issue over there.
Some streams that mimics the behaviour of a
Readable
doesn't implement the full interface which sometimes causes this to throw, e.g. https://github.com/kevva/resize-img/blob/master/index.js#L65. Since we can't enforce everyone to implementing streams correctly I think we should check ifunpipe
exists before running it.