async-iterators-kit
v1.0.1
Published
Wrappers around Node.js ReadableStream, Readline and ChildProcess that implement AsyncIterableIterator interface
Downloads
3
Maintainers
Readme
node-async-iterators-kit
Currently, the package provides a set of async iterators for handling readline, streams, child process stdout and timeouts:
See example:
const node = cp.spawn('node', ['-p', '2+2'], { stdio: 'pipe' });
const iterator = new ChildProcessStdioAsyncIterator(node, 'stdout');
for await (const line of iterator) {
lines.push(line); // [4]
break; // sends SIGTERM to the process if it has not exited yet
}