This package has been deprecated

Author message:

As

@libp2p/ipni-content-routing
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

⛔️ DEPRECATED

As of 1.1.0 the @helia/delegated-routing-v1-http-api-client module supports both the libp2p ContentRouting and PeerRouting interfaces so should be used instead.

This library will not be maintained.


@libp2p/ipni-content-routing

libp2p.io Discuss codecov CI

Use an IPNI service to discover content providers

Table of contents

Install

$ npm i @libp2p/ipni-content-routing

Browser <script> tag

Loading this module through a script tag will make it's exports available as Libp2pIpniContentRouting in the global namespace.

<script src="https://unpkg.com/@libp2p/ipni-content-routing/dist/index.min.js"></script>

About

This is an implementation of the libp2p content routing interface that uses an IPNI HTTP endpoint.

An alternative is HTTP Routing V1 (previously known as Reframe) but the advantage of IPNI at least as of 2023-05-19 is that it returns results in a streaming fashion which can be faster. Note that this will change with the rollout of IPIP-410, at which point one can use the HTTP Routing V1 interface/implementation directly.

Example

import { createLibp2p } from 'libp2p'
import { ipniContentRouting } from '@libp2p/ipni-content-routing'

const node = await createLibp2p({
  contentRouters: [
    ipniContentRouting('https://cid.contact')
  ]
  //.. other config
})
await node.start()

for await (const provider of node.contentRouting.findProviders('cid')) {
  console.log('provider', provider)
}

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Readme

Keywords

none

Package Sidebar

Install

npm i @libp2p/ipni-content-routing

Weekly Downloads

167

Version

2.0.2

License

Apache-2.0 OR MIT

Unpacked Size

74.7 kB

Total Files

10

Last publish

Collaborators

  • achingbrain
  • alanshaw
  • daviddias
  • jacobheun
  • npm-service-account-libp2p
  • vascosantos