src/vs/base/common/stream.ts/listenStream
export function listenStream<T>(stream: ReadableStreamEvents<T>, listener: IStreamListener<T>): void {
	stream.on('error', error => listener.onError(error));
	stream.on('end', () => listener.onEnd());

	// Adding the `data` listener will turn the stream
	// into flowing mode. As such it is important to
	// add this listener last (DO NOT CHANGE!)
	stream.on('data', data => listener.onData(data));
}