Files: c6635e24d61865bf851bce8707c19c1fa2429c02 / bin.js
759 bytesRaw
1 | |
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 | }) |
26 |
Built with git-ssb-web