git ssb

0+

cel / ssb-chunk-blob



Commit 07554367fe46654aa4984415ba3cfc02767f31c1

Init from &sgfeYThE8UmGbN2dnj41pSbtlCZOaPHdv3pTwgTFfYs=.sha256

cel committed on 12/9/2019, 1:03:17 AM

Files changed

bin.jsadded
bin.jsView
@@ -1,0 +1,25 @@
1 +#!/usr/bin/env node
2 +# © 2019 cel @f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519
3 +# Copying and distribution of this file, with or without modification,
4 +# are permitted in any medium without royalty provided the copyright
5 +# notice and this notice are preserved. This file is offered as-is,
6 +# without any warranty.
7 +
8 +var pull = require('pull-stream')
9 +var Block = require('pull-block')
10 +var Client = require('ssb-client')
11 +
12 +var id = process.argv[2]
13 +if (!id) throw new TypeError('need blob id')
14 +
15 +Client(function (err, sbot) {
16 + if (err) throw err
17 + pull(
18 + sbot.blobs.get(id),
19 + Block({size: 5242879, zeroPadding: false}),
20 + pull.asyncMap(function (buf, cb) {
21 + pull(pull.once(buf), sbot.blobs.add(cb))
22 + }),
23 + pull.log(sbot.close)
24 + )
25 +})

Built with git-ssb-web