Commit f791da7ccc8e720c47c297e2a39c746bfba7b8c3
Make example work for push
Charles Lehner committed on 2/8/2016, 4:37:24 AMParent: b057fe40960502a3d16c60aef0f67bf2078455fe
Files changed
README.md | changed |
README.md | ||
---|---|---|
@@ -5,19 +5,33 @@ | ||
5 | 5 | |
6 | 6 | ## Example |
7 | 7 | |
8 | 8 | ```js |
9 | +#!/usr/bin/env node | |
10 | + | |
9 | 11 | var toPull = require('stream-to-pull-stream') |
10 | 12 | var pull = require('pull-stream') |
11 | -var gitRemoteHelper = require('pull-git-remote-helper') | |
13 | +var gitRemoteHelper = require('.') | |
12 | 14 | |
13 | 15 | var options = { |
14 | - refSource: pull.values([]), | |
15 | - updateSink: pull.drain(console.error), | |
16 | - wantSink: pull.drain(console.error), | |
17 | - hasObject: function (hash, cb) { cb(false) }, | |
18 | - getObjects: /* ... /, | |
19 | - objectSink: /* ... */ | |
16 | + updateSink: pull.drain(function (update) { | |
17 | + console.error('Updating ' + update.name + ' to ' + update.new) | |
18 | + }), | |
19 | + objectSink: function (read) { | |
20 | + read(null, function next(end, object) { | |
21 | + if (end === true) return | |
22 | + if (end) throw end | |
23 | + pull( | |
24 | + object.read, | |
25 | + pull.collect(function (err, bufs) { | |
26 | + if (err) throw err | |
27 | + var buf = Buffer.concat(bufs, object.length) | |
28 | + console.error('Got object', object, buf) | |
29 | + read(null, next) | |
30 | + }) | |
31 | + ) | |
32 | + }) | |
33 | + } | |
20 | 34 | } |
21 | 35 | |
22 | 36 | pull( |
23 | 37 | toPull(process.stdin), |
Built with git-ssb-web