Created
March 21, 2019 13:51
-
-
Save laurentsenta/43843a6cc70297daf8f8d160395af8f7 to your computer and use it in GitHub Desktop.
3box-ipfs-did-test
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 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) | |
}) |
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 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