Optional
options: AbortOptions// ...
await contentRouting.cancelReprovide(cid)
Find the providers of the passed CID.
Optional
options: RoutingOptions// Iterate over the providers found for the given cid
for await (const provider of contentRouting.findProviders(cid)) {
console.log(provider.id, provider.multiaddrs)
}
Retrieves a value from the network corresponding to the passed key.
Optional
options: RoutingOptions// ...
const key = '/key'
const value = await contentRouting.get(key)
Search the network for peers that are closer to the passed key. Peer info should be yielded in ever-increasing closeness to the key.
Optional
options: RoutingOptions// Iterate over the closest peers found for the given key
for await (const peer of peerRouting.getClosestPeers(key)) {
console.log(peer.id, peer.multiaddrs)
}
The implementation of this method should ensure that network peers know the caller can provide content that corresponds to the passed CID.
Optional
options: RoutingOptions// ...
await contentRouting.provide(cid)
Puts a value corresponding to the passed key in a way that can later be retrieved by another network peer using the get method.
Optional
options: RoutingOptions// ...
const key = '/key'
const value = uint8ArrayFromString('oh hello there')
await contentRouting.put(key, value)
Helia will periodically re-provide every previously provided CID. Use this method to no longer re-provide the passed CID.