diff options
Diffstat (limited to 'lib/app.js')
-rw-r--r-- | lib/app.js | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -5,6 +5,8 @@ var pkg = require('../package') var u = require('./util') var pull = require('pull-stream') var ssbAvatar = require('ssb-avatar') +var hasher = require('pull-hash/ext/ssb') +var multicb = require('multicb') var Serve = require('./serve') var Render = require('./render') @@ -94,6 +96,19 @@ App.prototype.publish = function (content, cb) { } } +App.prototype.addBlob = function (cb) { + var done = multicb({pluck: 1, spread: true}) + var hashCb = done() + var addCb = done() + done(function (err, hash, add) { + cb(err, hash) + }) + return pull( + hasher(hashCb), + this.sbot.blobs.add(addCb) + ) +} + function getMsgWithValue(sbot, id, cb) { sbot.get(id, function (err, value) { if (err) return cb(err) |