git ssb

0+

cel / pull-git-remote-helper



Tree: b390ecc4bf4d610b201252d8a8a0cd1ad8cd2748

Files: b390ecc4bf4d610b201252d8a8a0cd1ad8cd2748 / README.md

3352 bytesRaw

pull-git-remote-helper

Make a git remote helper that integrates with git's internal objects.

Example

#!/usr/bin/env node

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

var options = {
  updateSink: pull.drain(function (update) {
    console.error('Updating ' + update.name + ' to ' + update.new)
  }),
  objectSink: function (read) {
    read(null, function next(end, object) {
      if (end === true) return
      if (end) throw end
      pull(
        object.read,
        pull.collect(function (err, bufs) {
          if (err) throw err
          var buf = Buffer.concat(bufs, object.length)
          console.error('Got object', object, buf)
          read(null, next)
        })
      )
    })
  }
}

pull(
  toPull(process.stdin),
  gitRemoteHelper(options),
  toPull(process.stdout)
)

API

The streams in this module are pull-streams.

TODO

License

Fair License

Built with git-ssb-web