0.0.2 • Published 6 years ago

pull-timeout2 v0.0.2

Weekly downloads
11
License
SEE LICENSE IN LI...
Repository
github
Last release
6 years ago

pull-timeout2 NPM version

Abort a pull-stream if the rate of flow drops below the specified threshold. Uses setTimeout() under-the-hood.

example

var pull = require('pull-stream')
var timeout = require('pull-timeout2')
var delay = 500

pull(
  pull.values([1, 2, 3, 4, 5, 6, 7, 8]),
  pull.asyncMap(function (num, next) {
    setTimeout(() => next(null, num), num * 100)
  }),
  timeout(delay),
  pull.log() // 1 2 3 4 5 <end>
)

license

License Zero Reciprocal Public License 2.0.1