aboutsummaryrefslogtreecommitdiff
path: root/lib/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/app.js')
-rw-r--r--lib/app.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/app.js b/lib/app.js
index 1daf064..8ef859f 100644
--- a/lib/app.js
+++ b/lib/app.js
@@ -177,10 +177,7 @@ App.prototype.addBlob = function (cb) {
done(function (err, hash, add) {
cb(err, hash)
})
- return pull(
- hasher(hashCb),
- this.sbot.blobs.add(addCb)
- )
+ return sink
}
App.prototype.pushBlob = function (id, cb) {
@@ -188,15 +185,25 @@ App.prototype.pushBlob = function (id, cb) {
this.sbot.blobs.push(id, cb)
}
-App.prototype.readBlob = function (link, opts) {
+App.prototype.readBlob = function (link) {
link = u.toLink(link)
- opts = opts || {}
return this.sbot.blobs.get({
hash: link.link,
size: link.size,
+ })
+}
+
+App.prototype.readBlobSlice = function (link, opts) {
+ if (this.sbot.blobs.getSlice) return this.sbot.blobs.getSlice({
+ hash: link.link,
+ size: link.size,
start: opts.start,
end: opts.end,
})
+ return pull(
+ this.readBlob(link),
+ u.pullSlice(opts.start, opts.end)
+ )
}
App.prototype.ensureHasBlobs = function (links, cb) {