truncating-stream

Transform stream that truncates

Usage no npm install needed!

<script type="module">
  import truncatingStream from 'https://cdn.skypack.dev/truncating-stream';
</script>

README

truncating-stream

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

Prompted by this node.js mailing list question

USAGE

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
})