git ssb

3+

Dominic / ssb-blobs



Tree: 7ff9053605e6aa539b6e50d0d18ce3c3b7fc5523

Files: 7ff9053605e6aa539b6e50d0d18ce3c3b7fc5523 / index.js

877 bytesRaw
1var create = require('./create')
2var path = require('path')
3var Inject = require('./inject')
4var Set = require('./set')
5var Level = require('level')
6
7exports.manifest = {
8 get: 'source',
9 add: 'sink',
10 ls: 'source',
11 has: 'async',
12 size: 'async',
13 meta: 'async',
14 want: 'async',
15 push: 'async',
16 changes: 'source',
17 createWants: 'source'
18}
19
20exports.name = 'blobs'
21
22exports.version = require('./package.json').version
23
24exports.permissions = {
25 anonymous: {allow: ['has', 'get', 'changes', 'createWants']},
26}
27
28exports.init = function (sbot, config) {
29 var blobs = Inject(
30 create(path.join(config.path, 'blobs')),
31 Set(Level(path.join(config.path, 'blobs_push'), {valueEncoding: 'json'})),
32 sbot.id,
33 config.blobs
34 )
35
36 sbot.on('rpc:connect', function (rpc) {
37 if (rpc.id === sbot.id) return
38 blobs._onConnect(rpc, rpc.id)
39 })
40 return blobs
41}
42
43

Built with git-ssb-web