How to use the infinite function from pull-stream

Find comprehensive JavaScript pull-stream.infinite code examples handpicked from public code repositorys.

151
152
153
154
155
156
157
158
159
160
    infinite(() => i++)
--1--2--3--4--5--6--7--8--
```
```js
var i = 0
const source = pull.infinite(() => i++)
const sink = pull.log()
pull(source, sink)
```
#### keys
fork icon46
star icon839
watch icon48

75
76
77
78
79
80
81
82
83
84
  return error && error.type === ERROR_TYPE_CREDS || isEnd(error);
}

function createPersistentLonpgollStream(api, rp, defaultTimeout = DEFAULT_TIMEOUT, maxTimeout = MAX_TIME_OUT) {
  return pull(
    pull.infinite(function() { return api; }),
    repeater(isEnd, defaultTimeout, maxTimeout),
    probe('creds'),
    credentialsStream,
    cacher(),
fork icon10
star icon34
watch icon15

31
32
33
34
35
36
37
38
39
40
//load below the screen bottom, so that normal reading is jankless.

//user provided source stream
function createSource (top) {
  return pull(
    pull.infinite(),
    pull.map(function (e) {
      c((c()||0)+1)
      return {random: e, count: c(), top: top}
    }),
fork icon3
star icon0
watch icon2

11
12
13
14
15
16
17
18
19
20
var h = require('mutant/h') //or hyperscript
var pull = require('pull-stream')

var obv = More(function (ary, item) {
  return [].concat(ary).concat(item)
}, pull.infinite(),
function (list, el) {
  //you might also use morphdom or just mutate the same element.
  return h('ol', list.map(function (n) { return h('li', ''+n) }))
})
fork icon0
star icon5
watch icon3

8
9
10
11
12
13
14
15
16
let duration = 5000;

let frameSize = 1024;

function sine () {
  return pull.infinite(function () {
    return util.noise(util.create(frameSize))
  })
}
fork icon0
star icon5
watch icon2

4
5
6
7
8
9
10
11
12
13
// connect to the echo endpoint for test/server.js
var socket = new WebSocket('wss://echo.websocket.org')

// write values to the socket
pull(
  pull.infinite(function () {
    return 'hello @ ' + Date.now()
  }),
  // throttle so it doesn't go nuts
  pull.asyncMap(function (value, cb) {
fork icon27
star icon0
watch icon2