The Channel class provides a promise-fluent API for creating async iterators. You can reuse the same constructor to convert event emitters, streams, websockets, or any other callback-based data source into a format which can be read using
for await…of statements.
Channels prevent common mistakes people make when rolling async iterators by hand. By executing lazily, dealing with backpressure, and propagating errors in a predictable manner, channels ensure that event listeners are cleaned up and that bottlenecks and deadlocks are discovered quickly.
You can use channels to implement architectural patterns like cancelable timers, semaphores, and generic pubsub classes. The Channel class also defines static methods like
Channel.merge which allow you to use async iterators for reactive programming purposes.