Package Exports
- libp2p-delegated-content-routing
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (libp2p-delegated-content-routing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
js-libp2p-delegated-content-routing
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
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-routingExample
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({
// use default api settings
protocol: 'https',
port: 443,
host: 'ipfs.io'
}))
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