How to use the pull-stream.drain function in pull-stream

To help you get started, we’ve selected a few pull-stream examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ssbc / ssb-db / legacy.js View on Github external
function migrate () {
          // actual upgrade
          pull(
            db.createLogStream({gt: since}),
            paramap(function (data, cb) {
              prog.current += 1
              flumedb.rawAppend(data, cb)
            }, 32),
            pull.drain(null, ready)
          )
        }
      }
github ssbc / ssb-db / test / replicate.js View on Github external
function init (sbs, n, cb) {
  var keys = ecc.generate(ecc.curves.k256)
  var f = sbs.feed(keys)
  pull(
    pull.values(rand(n)),
    pull.asyncMap(function (r, cb) {
      f.append(MESSAGE, ''+r, cb)
    }),
    pull.drain(null, function (err) {
      if(err) return cb(err)
      f.verify(cb)
    })
  )
  return keys
}
github ssbc / ssb-db / test / replicate2.js View on Github external
function init (sbs, n, cb) {
  var keys = ecc.generate(ecc.curves.k256)
  var f = sbs.feed(keys)
  pull(
    pull.values(rand(n)),
    pull.asyncMap(function (r, cb) {
      f.append(MESSAGE, ''+r, cb)
    }),
    pull.drain(null, function (err) {
      if(err) return cb(err)
      f.verify(cb)
    })
  )
  return f
}
github ssbc / ssb-db / bin.js View on Github external
scuttlebutt.feed(keys).verify(function (err) {
      if(err) throw err

      stream = exports[command](config._, config, done)
      if(stream)
        pull(stream, pull.through(console.log), pull.drain(null, done))

    })
  }
github ssbc / ssb-db / rewrite.js View on Github external
db.createWriteStream = function (cb) {
    return pull(
      paramap(function (data, cb) {
        db.add(data, cb)
      }),
      pull.drain(null, cb)
    )
  }

pull-stream

minimal pull stream

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis