wordcount-stream

1.0.0 • Public • Published

wordcount-stream

Build Status npm install

a stream that acts like wc

usage

var wcStream = require('wordcount-stream')
 
var wc = wcStream()
 
wc.write('tu tu') // ->
// {
//     characters: 5
//   , words: 2
//   , lines: 1
// }

notes

optionally accepts a callback as the only argument. if provided, counts will not be streamed as received, but instead the total will be passed to the callback (in the same form as outlined above).

var wcStream = require('wordcount-stream')
 
var wc = wcStream(done)
 
wc.write('tu ')
wc.write('tu')
wc.end()
 
function done(data) {
  console.log(data) // ->
  // {
  //     characters: 5
  //   , words: 2
  //   , lines: 1
  // }
}

license

MIT

Package Sidebar

Install

npm i wordcount-stream

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • jarofghosts