git ssb

0+

cel / ssb-chunk-blob



Tree: 3a714678a1ee0975dbc17eaab24623d110b724a3

Files: 3a714678a1ee0975dbc17eaab24623d110b724a3 / bin.js

759 bytesRaw
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
8var pull = require('pull-stream')
9var Block = require('pull-block')
10var Client = require('ssb-client')
11
12var id = process.argv[2]
13if (!id) throw new TypeError('need blob id')
14
15Client(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})
26

Built with git-ssb-web