Helia
    Preparing search index...
    interface Routing {
        cancelReprovide(key: CID, options?: AbortOptions): Promise<void>;
        findPeer(peerId: PeerId, options?: RoutingOptions): Promise<PeerInfo>;
        findProviders(cid: CID, options?: RoutingOptions): AsyncIterable<Provider>;
        get(
            key: Uint8Array,
            options?: RoutingOptions,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        getClosestPeers(
            key: Uint8Array,
            options?: RoutingOptions,
        ): AsyncIterable<PeerInfo>;
        provide(cid: CID, options?: RoutingOptions): Promise<void>;
        put(
            key: Uint8Array,
            value: Uint8Array,
            options?: RoutingOptions,
        ): Promise<void>;
    }
    Index

    Methods

    • Search the network for peers that are closer to the passed key. Peer info should be yielded in ever-increasing closeness to the key.

      Parameters

      Returns AsyncIterable<PeerInfo>

      // Iterate over the closest peers found for the given key
      for await (const peer of peerRouting.getClosestPeers(key)) {
      console.log(peer.id, peer.multiaddrs)
      }