How to use the pull-stream.values 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 dominictarr / pull-fs / test / read.js View on Github external
test('write a file', function (t) {
  var lines = ['a\n', 'b\n', 'c\n'].map(Buffer)
  var file = '/tmp/test-pfs-write'
  pull(
    pull.values(lines),
    pfs.write(file, function (err) {
      if(err) throw err
      fs.readFile(file, 'utf-8', function (err, data) {
        if(err) throw err
        t.equal(data, lines.join(''))
        t.end()
      })
    })
  )
})
github ssbc / multi0a4db20406775263583a31603406b34b33bfe1e3 / test / size.js View on Github external
tape('add, size', function (t) {

  pull(
    pull.values(random1),
    blobs.add(function (err, hash) {
      if(err) throw err
      t.equal(hash, hash1)
      blobs.size(hash, function (_, size) {
        t.equal(size, 100*1024)
        t.end()
      })
    })
  )
})
github ssbc / multicfd64636ed26aacf9abe6a98e786c83caada3dc7 / test / live.js View on Github external
function hasher (ary) {
    var hasher = util.createHash(alg, true)
    pull(pull.values(ary), hasher, pull.drain())
    return util.encode(hasher.digest, alg)
  }
github mmckegg / patchwork-next / lib / replicate-with-progress.js View on Github external
function upto (opts) {
      opts = opts || {}
      var ary = Object.keys(toSend).map(function (k) {
        return { id: k, sequence: toSend[k] }
      })
      if (opts.live) {
        return Cat([pull.values(ary), pull.once({sync: true}), newPeer.listen()])
      }

      return pull.values(ary)
    }
github ssbc / ssb-server / plugins / replicate / legacy.js View on Github external
function upto (opts) {
    opts = opts || {}
    var ary = Object.keys(replicate).map(function (k) {
      return { id: k, sequence: toSend[k]||0 }
    })
    if(opts.live)
      return Cat([
        pull.values(ary),
        pull.once({sync: true}),
        newPeers.listen()
      ])

    return pull.values(ary)
  }

pull-stream

minimal pull stream

MIT
Latest version published 2 years ago

Package Health Score

57 / 100
Full package analysis