nodejs/express - stream stdout instantly to the client
问题 I spawned the following child: var spw = spawn('ping', ['-n','10', '127.0.0.1']) and I would like to receive the ping results on the client side ( browser ) one by one , not as a whole. So far I tried this: app.get('/path', function(req, res) { ... spw.stdout.on('data', function (data) { var str = data.toString(); res.write(str + "\n"); }); ... } and that: ... spw.stdout.pipe(res); ... In both cases browser waits 10 of the pings to complete, and then prints the result as a whole. I would like