In this blog post, we run shell commands as child processes in Node.js. We then use async language features to read the stdouts of those processes and write to their stdins.
Let’s start with running a shell command in a child process:
The following code uses @rauschma/stringio to asynchronously write to the stdin of a child process running a shell command:
We spawn a separate process, called sink, for the shell command. writeToWritable writes to sink.stdin. It does so asynchronously and pauses via await, to avoid requiring too much buffering.
Read More