Files: 4e8098bd7759c55142a8f7b79e5293b520a2d32c / example.js
667 bytesRaw
1 | var pull = require('pull-stream') |
2 | |
3 | var v = require('./') |
4 | var state = { |
5 | queue: [], |
6 | feeds: {}, |
7 | error: null |
8 | } |
9 | |
10 | var c = 0, e = 0, start = Date.now(), l = 0 |
11 | require('ssb-client')(function (err, sbot) { |
12 | if(err) throw err |
13 | pull( |
14 | sbot.createLogStream(), |
15 | pull.drain(function (msg) { |
16 | state = v.append(state, msg.value) |
17 | if(state.error) { |
18 | e++ |
19 | var err = state.error |
20 | state.error = null |
21 | console.log(err.message) |
22 | return false |
23 | } |
24 | state.queue.shift() |
25 | var s = ((Date.now() - start)/1000) |
26 | if(!(c++%1000)) { |
27 | console.log(s, e, c, c / s) |
28 | } |
29 | return true |
30 | }, sbot.close) |
31 | ) |
32 | }) |
33 |
Built with git-ssb-web