1.0.2 • Published 9 months ago

@libp2p/reframe-content-routing v1.0.2

Weekly downloads
-
License
Apache-2.0 OR MIT
Repository
github
Last release
9 months ago

@libp2p/reframe-content-routing

libp2p.io Discuss codecov CI

Use a Reframe service to discover content providers

Table of contents

Install

$ npm i @libp2p/reframe-content-routing

Browser <script> tag

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

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

Example

import { createLibp2p } from 'libp2p'
import { reframeContentRouting } from '@libp2p/reframe-content-routing'

const node = await createLibp2p({
  contentRouters: [
    reframeContentRouting('https://cid.contact/reframe')
  ]
  //.. 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.