Skip to content

pull-stream/pull-next

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pull-next

read from one pull-stream, then the next, then the next...

when one stream end (unless it errored) call a function to get the next stream. much like pull-cat except creates streams by calling a function instead of takeing them out of an array.

in particular, this is useful for making a read stream that reconnects to a source.

example

create a stream that reads from a leveldb 100 items at a time.

var next = require('pull-next')
var pl = require('pull-level')
var db = require('level')(path_to_level)

function resume () {
  var last = null
  return Next(function () {
    return pull(
      pl.read(db, {gt: last && last.key, limit: 100}),
      pull.through(function (data) { last = data })
    )
  })
}

hint: this might be even more useful over multilevel

License

MIT

About

call a function to get the next stream

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published