Skip to content
Myr

Improve a readme example (#235)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by Sindre Sorhus · parent e55dc8b · Browse files · 1 file+6 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>

Diff stats

1 file+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:readme.md+6 added-6 removed
325 unmodified lines
326Let's say you want to show the output of a child process in real-time while also saving it to a variable.327328```js329const execa = require('execa');330const getStream = require('get-stream');330332const stream = execa('echo', ['foo']).stdout;331const subprocess = execa('echo', ['foo']);332334stream.pipe(process.stdout);333subprocess.stdout.pipe(process.stdout);334336getStream(stream).then(value => {337 console.log('child output:', value);338});335(async () => {336 const {stdout} = await subprocess;337 console.log('child output:', stdout);338})();339```340341342## Maintainers
3 unmodified lines