Package Exports
- pull-offset-limit
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pull-offset-limit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pull-offset-limit
A pull-stream that filters until X elements, and stops streaming after Y elements. Useful for pagination purposes.
Usage
const pull = require('pull-stream')
const split = require('pull-split')
const offsetLimit = require('pull-offset-limit')
pull(
textStream, // some text stream
split(), // split on new lines
offsetLimit(5, 20), // after 5 lines, take 20
output
)
API
offsetLimit = require('pull-offset-limit')(offset, limit, onLimit)
Create a new offsetLimit through stream.
- offset: if set, filters stream until offset is reached
- limit: if set, stops stream when limit is reached
- onLimit: if set, runs when limit is reached
Installation
$ npm install pull-offset-limit