以下の内容はhttps://otiai10.hatenablog.com/entry/2019/05/30/121611より取得しました。


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]');
    console.log(chunk.toString());
});

f:id:otiai10:20190530121345p:plain

おわりです。うごくやつです。

github.com

DRYな備忘録として




以上の内容はhttps://otiai10.hatenablog.com/entry/2019/05/30/121611より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14