# @libp2p/delegated-content-routing

> Leverage other peers in the libp2p network to perform Content Routing calls.

Latest version **4.0.11** (published 2023-10-09) · Apache-2.0 OR MIT license · 0 weekly downloads

## Install

```sh
npm install @libp2p/delegated-content-routing
pnpm add @libp2p/delegated-content-routing
yarn add @libp2p/delegated-content-routing
bun add @libp2p/delegated-content-routing
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.11 |
| Published | 2023-10-09 |
| First published | 2022-02-22 |
| Weekly downloads | 0 |
| License | Apache-2.0 OR MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Dependencies | 11 |
| Unpacked size | 68.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 14 |
| Maintainers | jacobheun, npm-service-account-libp2p, alanshaw, vascosantos, achingbrain, daviddias |

## Links

- npm: https://www.npmjs.com/package/@libp2p/delegated-content-routing
- Repository: https://github.com/libp2p/js-libp2p-delegated-content-routing
- Homepage: https://github.com/libp2p/js-libp2p-delegated-content-routing#readme
- Issues: https://github.com/libp2p/js-libp2p-delegated-content-routing/issues
- npm.io page: https://npm.io/package/@libp2p/delegated-content-routing

## Dependencies (11)

- [p-defer](https://npm.io/package/p-defer.md) ^4.0.0
- [p-queue](https://npm.io/package/p-queue.md) ^7.3.4
- [err-code](https://npm.io/package/err-code.md) ^3.0.1
- [it-drain](https://npm.io/package/it-drain.md) ^3.0.3
- [any-signal](https://npm.io/package/any-signal.md) ^4.1.1
- [multiformats](https://npm.io/package/multiformats.md) ^12.0.1
- [@libp2p/logger](https://npm.io/package/@libp2p/logger.md) ^3.0.2
- [@libp2p/interfaces](https://npm.io/package/@libp2p/interfaces.md) ^3.3.2
- [@libp2p/interface-peer-id](https://npm.io/package/@libp2p/interface-peer-id.md) ^2.0.2
- [@libp2p/interface-peer-info](https://npm.io/package/@libp2p/interface-peer-info.md) ^1.0.10
- [@libp2p/interface-content-routing](https://npm.io/package/@libp2p/interface-content-routing.md) ^2.1.1

## Recent versions

- 4.0.11 (latest) — 2023-10-09
- 4.0.10 — 2023-10-06
- 4.0.9 — 2023-08-24
- 4.0.8 — 2023-08-07
- 4.0.7 — 2023-08-07
- 4.0.6 — 2023-07-04
- 4.0.5 — 2023-05-31
- 4.0.4 — 2023-05-31
- 4.0.3 — 2023-03-21
- 4.0.2 — 2023-03-21
- 4.0.1 — 2023-02-14
- 4.0.0 — 2023-01-06
- 3.0.1 — 2022-12-16
- 3.0.0 — 2022-10-13
- 2.0.2 — 2022-09-21
- … 9 more at https://npm.io/package/@libp2p/delegated-content-routing/versions

## README

# @libp2p/delegated-content-routing <!-- omit in toc -->

[![libp2p.io](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![Discuss](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg?style=flat-square)](https://discuss.libp2p.io)
[![codecov](https://img.shields.io/codecov/c/github/libp2p/js-libp2p-delegated-content-routing.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p-delegated-content-routing)
[![CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p-delegated-content-routing/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/libp2p/js-libp2p-delegated-content-routing/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)

> Leverage other peers in the libp2p network to perform Content Routing calls.

## Table of contents <!-- omit in toc -->

- [Install](#install)
  - [Browser `<script>` tag](#browser-script-tag)
- [Requirements](#requirements)
- [Example](#example)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/delegated-content-routing
```

### Browser `<script>` tag

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

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

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.

## Requirements

`@libp2p/delegated-content-routing` leverages the `kubo-rpc-client` library and requires an instance of it as a constructor argument.

```sh
npm install kubo-rpc-client @libp2p/delegated-content-routing
```

## Example

```js
import { createLibp2p } from 'libp2p'
import { delegatedContentRouting } from '@libp2p/delegated-content-routing'
import { create as createIpfsHttpClient } from 'kubo-rpc-client'

// default is to use ipfs.io
const client = createIpfsHttpClient({
  // use default api settings
  protocol: 'https',
  port: 443,
  host: 'node0.delegate.ipfs.io'
})

const node = await createLibp2p({
  peerRouting: [
    delegatedContentRouting(client)
  ]
  //.. other config
})
await node.start()

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

## API Docs

- <https://libp2p.github.io/js-libp2p-delegated-content-routing>

## License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## 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.

---
_Source: https://npm.io/package/@libp2p/delegated-content-routing · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
