ln-stream
v1.0.2
Published
for-each line processor for a too big data
Downloads
2
Readme
ln-stream
for each line processor
attach proc
for a line
and defer
the post-processor
lnstream = require('ln-stream')
lnstream(filename, proc, defer)
wc-like program
lnstream = require 'ln-stream'
lines = 0
words = 0
chars = 0
# processer for each line
proc = (line) ->
lines += 1
words += line.split ' '
.length
chars += line.length
# after the all lines
defer = () ->
console.log "%d %d %d", lines, words, chars
lnstream './README.md', proc, defer
# => 36 120 504