title: Node.js pass text as stdin of `spawnSync`
body: <p>I'd think this would be simple, but the following does not work as expected.</p>
  
  <p>I want to pipe data to a process, say (just an arbitrary command for illustration) <code>wc</code>, from Node.</p>
  
  <p>The <a href="https://nodejs.org/api/child_process.html#child_process_options_stdio" rel="noreferrer">docs</a> and other <a href="https://stackoverflow.com/a/22085851/19212">SO questions</a> seem to indicate that passing a Stream should work:</p>
  
  <pre><code>const {spawnSync} = require('child_process')
  const {Readable} = require('stream')
  
  const textStream = new Readable()
  textStream.push("one two three")
  textStream.push(null)
  
  const stdio = [textStream, process.stdout, process.stderr]
  spawnSync('wc', ["-c"], { stdio })
  </code></pre>
  
  <p>Unfortunately this throws an error:</p>
  
  <blockquote>
    <p>The value "Readable { ... } is invalid for option "stdio"</p>
  </blockquote>
  
  <p>The <a href="https://github.com/nodejs/node/blob/master/lib/internal/child_process.js#L829-L905" rel="noreferrer">relevant bit of code from <code>internal/child_process.js</code></a> does not immediately reveal what the anticipated valid options are.</p>