Files: 9e4b77aeb7181a93a9ee3ceb1c21d11841a35f57 / tmpl / basics / read-the-log.html.js
844 bytesRaw
1 | var page = require('../page.part') |
2 | var com = require('../com.part') |
3 | |
4 | module.exports = () => page({ |
5 | tab: 'basics', |
6 | path: '/basics/read-the-log.html', |
7 | content: ` |
8 | <h2>Read the log</h2> |
9 | ${ com.code({ js: jsSnippet, bash: bashSnippet }) } |
10 | <p class="next"><a href="/basics/publish-a-message.html">Publish a message</a></p> |
11 | <ul class="see-also"> |
12 | <li><a href="/modules/scuttlebot.html"><code>createLogStream()</code> API</a></li> |
13 | <li><a href="/advanced/advanced-queries.html">Advanced queries</a></li> |
14 | <li><a href="/advanced/pull-streams.html">Pull streams</a></li> |
15 | </ul> |
16 | ` |
17 | }) |
18 | |
19 | var jsSnippet = ` |
20 | var pull = require('pull-stream') |
21 | pull( |
22 | ssb.createLogStream({ limit: 100 }), |
23 | pull.collect(err, msgs) { |
24 | if (err) |
25 | throw err |
26 | console.log(msgs) |
27 | }) |
28 | ) |
29 | ` |
30 | |
31 | var bashSnippet = ` |
32 | sbot log --limit 100 |
33 | ` |
Built with git-ssb-web