Socket
Socket
Sign inDemoInstall

libp2p-delegated-content-routing

Package Overview
Dependencies
100
Maintainers
3
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    libp2p-delegated-content-routing

Leverage other peers in the libp2p network to perform Content Routing calls.


Version published
Weekly downloads
2.4K
decreased by-56.01%
Maintainers
3
Install size
11.1 MB
Created
Weekly downloads
 

Readme

Source

js-libp2p-delegated-content-routing

Discourse posts Dependency Status

Leverage other peers in the network to perform Content Routing calls.

Requires access to /api/v0/dht/findprovs and /api/v0/refs HTTP API endpoints of the delegate node.

Lead Maintainer

Jacob Heun

Requirements

libp2p-delegated-content-routing leverages the ipfs-http-client library and requires an instance of it as a constructor argument.

npm install ipfs-http-client libp2p-delegated-content-routing

Example

const DelegatedContentRouting = require('libp2p-delegated-content-routing')
const ipfsHttpClient = require('ipfs-http-client')

// default is to use ipfs.io
const routing = new DelegatedContentRouting(peerId, ipfsHttpClient.create({
  // use default api settings
  protocol: 'https',
  port: 443,
  host: 'node0.delegate.ipfs.io' // In production you should setup your own delegates
}))
const cid = new CID('QmS4ustL54uo8FzR9455qaxZwuMiUhyvMcX9Ba8nUH4uVv')

for await (const { id, multiaddrs } of routing.findProviders(cid)) {
  console.log('found peer', id, multiaddrs)
}

await routing.provide(cid)
console.log('providing %s', cid.toBaseEncodedString())

License

MIT

FAQs

Last updated on 15 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc