Why does concat-stream not work with process.stdin.pipe ()?

Here is my code:

var concat = require('concat-stream');
process.stdin.pipe(concat(function(){console.log("output")}));

What I expect from this is to output "output" every time I enter console input, but this does not work. Does anyone have an idea why this is not working? If I create an fs.createReadStream () buffer, it works fine, just not with process.stdin.pipe (). However, I used process.stdin.pipe () for other things, and they worked just fine.

Thanks in advance!

+4
source share
1 answer

The reason you are not getting an exit is because you are not actually closing the stdin, which is concat-streamto ensure that it does not know that there will be no more data.

+2
source

All Articles