Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. const IPFS = require('ipfs')
  2.  
  3. const options = {
  4. config: {
  5. Addresses: {
  6. Swarm: [],
  7. },
  8. Discovery: {
  9. MDNS: {
  10. enabled: false
  11. }
  12. }
  13. },
  14. repo: './test-get'
  15. }
  16.  
  17. const node = new IPFS(options)
  18.  
  19. node.on('ready', async () => {
  20. // 'did:muport:Qmb9E8wLqjfAqfKhideoApU5g26Yz2Q2bSp6MSZmc5WrNr'
  21. const p = 'Qmb9E8wLqjfAqfKhideoApU5g26Yz2Q2bSp6MSZmc5WrNr'
  22.  
  23. const X = async () => console.error('peers=', (await node.swarm.addrs()).map(x => x.id.toB58String()))
  24. setInterval(X, 5000)
  25.  
  26. console.error('start')
  27. const f = await node.files.cat(p)
  28. console.error('found it! f=', f)
  29. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement