Transform stream that truncates

npm install truncating-stream
2 downloads in the last week
9 downloads in the last month


A Node v0.10 Transform stream that truncates its input at a specified limit.

Prompted by this node.js mailing list question


var t = new Trunc ({ limit : someNumber })

readable . pipe (t)

var seen = 0
t . on ('data', function (chunk) {
  seen += chunk . length // will never go past someNumber
npm loves you