Skip to content

Instantly share code, notes, and snippets.

@poga
Last active October 2, 2016 05:30
Show Gist options
  • Select an option

  • Save poga/7cbeca4d8aa0aae5262fb1a81cd4501e to your computer and use it in GitHub Desktop.

Select an option

Save poga/7cbeca4d8aa0aae5262fb1a81cd4501e to your computer and use it in GitHub Desktop.
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')
})
}
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