I am trying to understand TS async generators.
In Node.js, I open a socket, read all data from it, then close it.
I am attempting to make this into an async generator over the chunks of data.
async function* connectAndRead() {
const socket = net.connect(80, 'localhost');
socket.on('data', data => ???);
socket.on('end', socket.close());
}
It is possible to make an async generator for data read from a socket?