Files: f99e3d7f563e4c69140b31af2e6e873e067b24b7 / blob / sync / url.js
502 bytesRaw
1 | const nest = require('depnest') |
2 | |
3 | exports.gives = nest('blob.sync.url') |
4 | |
5 | exports.needs = nest({ |
6 | 'config.sync.load': 'first' |
7 | }) |
8 | |
9 | exports.create = function (api) { |
10 | return nest('blob.sync.url', function (link) { |
11 | var config = api.config.sync.load() |
12 | var prefix = config.blobsPrefix != null ? config.blobsPrefix : `http://localhost:${config.ws.port}/blobs/get` |
13 | if (link && typeof link.link === 'string') { |
14 | link = link.link |
15 | } |
16 | return `${prefix}/${encodeURIComponent(link)}` |
17 | }) |
18 | } |
19 |
Built with git-ssb-web