Last active
October 2, 2016 05:30
-
-
Save poga/7cbeca4d8aa0aae5262fb1a81cd4501e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 hyperdrive = require('hyperdrive') | |
| const swarm = require('hyperdrive-archive-swarm') | |
| const memdb = require('memdb') | |
| var d1 = hyperdrive(memdb()) | |
| var a1 = d1.createArchive() | |
| debug(swarm(a1)) | |
| console.log('a1', a1.key.toString('hex')) | |
| var d2 = hyperdrive(memdb()) | |
| var a2 = d2.createArchive() | |
| debug(swarm(a2)) | |
| console.log('a2', a2.key.toString('hex')) | |
| var d3 = hyperdrive(memdb()) | |
| var a3 = d3.createArchive() | |
| debug(swarm(a3)) | |
| console.log('a3', a3.key.toString('hex')) | |
| function debug (sw) { | |
| sw.on('connection', () => { | |
| console.log('connected') | |
| }) | |
| } |
This file contains hidden or 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 hyperdrive = require('hyperdrive') | |
| const swarm = require('hyperdrive-archive-swarm') | |
| const memdb = require('memdb') | |
| var d1 = hyperdrive(memdb()) | |
| var a1 = d1.createArchive('<A1 KEY>') | |
| debug(swarm(a1), a1.key) | |
| var d2 = hyperdrive(memdb()) | |
| var a2 = d2.createArchive('<A2 KEY>') | |
| debug(swarm(a2), a2.key) | |
| var d3 = hyperdrive(memdb()) | |
| var a3 = d3.createArchive('<A3 KEY>') | |
| debug(swarm(a3), a3.key) | |
| function debug (sw, key) { | |
| sw.on('connection', () => { | |
| console.log(key.toString('hex'), 'connected') | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment