1.0.0 • Published 7 years ago

pull-limit-size v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

Pull limit size

Throw an error if more than x bytes' are consumed.

' Uses chunk.length to count so might work with other things than buffers.

npm install pull-limit-size
const limit = require('pull-limit-size')
const { pull, values, log } = require('pull-stream')

pull(
	values([ Buffer.from([ 0xff, 0xff, 0xff ]) ]),
	limit(2),
	log(err => console.log(err))
	// -> { [Error: Maximum size reached] message: 'Maximum size reached' }
)