git ssb

2+

cel / scuttlebot.io



Tree: eedd3e12be4658709953cc735438aec88a79819e

Files: eedd3e12be4658709953cc735438aec88a79819e / tmpl / apis / pull-stream / stream-to-pull-stream.md

627 bytesRaw

stream-to-pull-stream

Convert a classic-stream, or a new-stream into a pull-stream

example

var toPull = require('stream-to-pull-stream')
var pull = require('pull-stream')

pull(
  toPull.source(fs.createReadStream(__filename)),
  pull.map(function (e) { return e.toString().toUpperCase() }),
  toPull.sink(process.stdout, function (err) {
    if(err) throw err
    console.log('done')
  })
)

if the node steam is a duplex (i.e. net, ws) then use toPull.duplex(stream, cb?)
duplex takes an optional callback in the same way that sink does.

License

MIT

Built with git-ssb-web