Streams implementation of wc(1)
.
const wc = require('wc-stream');
process.stdin
.pipe(wc())
.on('data', function (count) {
console.dir(count);
})
$ echo 'foo bar' | node example.js
{ word: 2, line: 1, char: 8 }
Create an object mode Transform stream. See example above.
ISC License.