Files: 12cc851c71e6ab09d98c2ce054c7ae44d20f85b3 / test / git-remote-test.js
824 bytesRaw
1 | |
2 | |
3 | var toPull = require('stream-to-pull-stream') |
4 | var pull = require('pull-stream') |
5 | |
6 | pull( |
7 | toPull(process.stdin), |
8 | require('../')({ |
9 | prefix: 'foo', |
10 | objectSink: function (readObject) { |
11 | readObject(null, function next(end, type, read) { |
12 | if (end === true) return |
13 | if (end) throw end |
14 | pull( |
15 | read, |
16 | pull.collect(function (err, bufs) { |
17 | if (err) throw err |
18 | var data = Buffer.concat(bufs).toString('ascii') |
19 | console.error('object', type, bufs.length, data.length, JSON.stringify(data)) |
20 | readObject(null, next) |
21 | }) |
22 | ) |
23 | }) |
24 | }, |
25 | refSink: pull.drain(function (ref) { |
26 | console.error('ref', ref) |
27 | }), |
28 | }), |
29 | toPull(process.stdout, function (err) { |
30 | if (err) |
31 | throw err |
32 | }) |
33 | ) |
34 |
Built with git-ssb-web