Skip to content
Myr

Add tips about redirecting streams to files (#292)

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 eefe05f · Browse files · 1 file+18 added−1 removed
This commit

State

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

Diff stats

1 file+18 added−1 removed

  • other:+18 added−1 removed

1 file+18 added−1 removed

modified:readme.md+18 added-1 removed
440 unmodified lines
441```js442const execa = require('execa');443444const subprocess = execa('echo', ['foo']);445445subprocess.stdout.pipe(process.stdout);446447(async () => {448 const {stdout} = await subprocess;449 console.log('child output:', stdout);450})();451```452453### Redirect output to a file454455```js456const execa = require('execa');457458const subprocess = execa('echo', ['foo'])459subprocess.stdout.pipe(fs.createWriteStream('stdout.txt'))460```461462### Redirect input from a file463464```js465const execa = require('execa');466467const subprocess = execa('cat')468fs.createReadStream('stdin.txt').pipe(subprocess.stdin)469```470471472## Related473474- [gulp-execa](https://github.com/ehmicky/gulp-execa) - Gulp plugin for `execa`475
18 unmodified lines