Skip to content

Instantly share code, notes, and snippets.

@laurentsenta
Created March 21, 2019 13:51
Show Gist options
  • Save laurentsenta/43843a6cc70297daf8f8d160395af8f7 to your computer and use it in GitHub Desktop.
Save laurentsenta/43843a6cc70297daf8f8d160395af8f7 to your computer and use it in GitHub Desktop.
3box-ipfs-did-test
const IPFS = require('ipfs')
const options = {
config: {
Addresses: {
Swarm: [],
},
Discovery: {
MDNS: {
enabled: false
}
}
},
repo: './test-get'
}
const node = new IPFS(options)
node.on('ready', async () => {
// 'did:muport:Qmb9E8wLqjfAqfKhideoApU5g26Yz2Q2bSp6MSZmc5WrNr'
const p = 'Qmb9E8wLqjfAqfKhideoApU5g26Yz2Q2bSp6MSZmc5WrNr'
const X = async () => console.error('peers=', (await node.swarm.addrs()).map(x => x.id.toB58String()))
setInterval(X, 5000)
console.error('start')
const f = await node.files.cat(p)
console.error('found it! f=', f)
})
const IPFS = require('ipfs')
const options = {
config: {
Addresses: {
Swarm: [],
},
Bootstrap: [
'/dnsaddr/ipfs.3box.io/tcp/443/wss/ipfs/QmZvxEpiVNjmNbEKyQGvFzAY1BwmGuuvdUTmcTstQPhyVC'
],
Discovery: {
MDNS: {
enabled: false
}
}
},
repo: './test-get'
}
const node = new IPFS(options)
node.on('ready', async () => {
// 'did:muport:Qmb9E8wLqjfAqfKhideoApU5g26Yz2Q2bSp6MSZmc5WrNr'
const p = 'Qmb9E8wLqjfAqfKhideoApU5g26Yz2Q2bSp6MSZmc5WrNr'
const X = async () => console.error('peers=', (await node.swarm.addrs()).map(x => x.id.toB58String()))
setInterval(X, 5000)
console.error('start')
const f = await node.files.cat(p)
console.error('found it! f=', f)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment