mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 14:34:19 +01:00
Fixed command-line argument parameter parsing across files from process.argv[2] to process.argv[3] (#115)
This commit is contained in:
@@ -67,8 +67,8 @@ import DHT from 'hyperdht'
|
|||||||
import b4a from 'b4a'
|
import b4a from 'b4a'
|
||||||
import process from 'bare-process'
|
import process from 'bare-process'
|
||||||
|
|
||||||
console.log('Connecting to:', process.argv[2])
|
console.log('Connecting to:', process.argv[3])
|
||||||
const publicKey = b4a.from(process.argv[2], 'hex')
|
const publicKey = b4a.from(process.argv[3], 'hex')
|
||||||
|
|
||||||
const dht = new DHT()
|
const dht = new DHT()
|
||||||
const conn = dht.connect(publicKey)
|
const conn = dht.connect(publicKey)
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ Pear.teardown(() => swarm.destroy())
|
|||||||
swarm.on('connection', conn => store.replicate(conn))
|
swarm.on('connection', conn => store.replicate(conn))
|
||||||
|
|
||||||
// create/get the hypercore instance using the public key supplied as command-line arg
|
// create/get the hypercore instance using the public key supplied as command-line arg
|
||||||
const core = store.get({ key: b4a.from(process.argv[2], 'hex') })
|
const core = store.get({ key: b4a.from(process.argv[3], 'hex') })
|
||||||
|
|
||||||
// create a hyperbee instance using the hypercore instance
|
// create a hyperbee instance using the hypercore instance
|
||||||
const bee = new Hyperbee(core, {
|
const bee = new Hyperbee(core, {
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ Pear.teardown(() => swarm.destroy())
|
|||||||
swarm.on('connection', conn => store.replicate(conn))
|
swarm.on('connection', conn => store.replicate(conn))
|
||||||
|
|
||||||
// create or get the hypercore using the public key supplied as command-line argument
|
// create or get the hypercore using the public key supplied as command-line argument
|
||||||
const core = store.get({ key: b4a.from(process.argv[2], 'hex') })
|
const core = store.get({ key: b4a.from(process.argv[3], 'hex') })
|
||||||
// wait till the properties of the hypercore instance are initialized
|
// wait till the properties of the hypercore instance are initialized
|
||||||
await core.ready()
|
await core.ready()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user