aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/app.js b/lib/app.js
index faed5fc..5d8af70 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -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)