DRYな備忘録

Don't Repeat Yourself.

2019-05-30から1日間の記事一覧

Node.jsのchild_process間で、標準出力のpipe

これをやりたい↓ cat ./testdata.txt | grep otiai JavaScriptで、 const cat = spawn('cat', ['./testdata.txt']); const grep = spawn('grep', ['otiai']); cat.stdout.pipe(grep.stdin); grep.stdout.on('data', (chunk) => { console.log('[grep]'); con…