Skip to content

srcagency/pull-limit-size

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Limit the amount of data in a pull-stream

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published