Created
February 5, 2020 13:10
-
-
Save mafintosh/7469fd306a24049214168715b6bd72dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Corestore = require('corestore') | |
const SwarmNetworker = require('corestore-swarm-networking') | |
const store = new Corestore('./path-1') | |
store.ready(function () { | |
const swarm = new SwarmNetworker(store) | |
const feed = store.default() | |
swarm.listen() | |
feed.ready(() => { | |
swarm.seed(feed.discoveryKey) | |
console.log('key: ' + feed.key.toString('hex')) | |
console.log(feed) | |
}) | |
feed.get(0, console.log) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Corestore = require('corestore') | |
const SwarmNetworker = require('corestore-swarm-networking') | |
const store = new Corestore('./path-2') | |
store.ready(function () { | |
const swarm = new SwarmNetworker(store) | |
const feed = store.get(Buffer.from('... from above ...', 'hex')) | |
swarm.listen() | |
feed.ready(() => { | |
swarm.seed(feed.discoveryKey) | |
console.log(feed) | |
}) | |
feed.get(0, console.log) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment