I have a stream that may or may not have already ended. If it has ended, I don't want to sit there forever waiting for the end
event. How do I check?
As of node 12.9.0, readable streams have a readableEnded
property you can check – see readable.readableEnded
in the Stream documentation.
(Writable streams have a corresponding property)