# ipfs-race

> Resolve an IPFS path using multiple gateways and methods to get data the fastest.

Latest version **0.2.3** (published 2024-03-07) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install ipfs-race
pnpm add ipfs-race
yarn add ipfs-race
bun add ipfs-race
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2024-03-07 |
| First published | 2022-11-23 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 39.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Frame One Software Inc. |
| Maintainers | christopher_powroznik |

## Links

- npm: https://www.npmjs.com/package/ipfs-race
- Repository: https://github.com/Frame-One-Software/ipfs-race
- Homepage: https://github.com/Frame-One-Software/ipfs-race#readme
- Issues: https://github.com/Frame-One-Software/ipfs-race/issues
- npm.io page: https://npm.io/package/ipfs-race

## Dependencies (3)

- [is-ipfs](https://npm.io/package/is-ipfs.md) 6.0.2
- [promise.any](https://npm.io/package/promise.any.md) ^2.0.5
- [node-abort-controller](https://npm.io/package/node-abort-controller.md) ^3.0.1

## Recent versions

- 0.2.3 (latest) — 2024-03-07
- 0.2.2 — 2023-10-12
- 0.2.1 — 2023-03-20
- 0.2.0 — 2023-01-31
- 0.1.7 — 2023-01-11
- 0.1.6 — 2023-01-09
- 0.1.4 — 2022-12-09
- 0.1.3 — 2022-11-24
- 0.1.2 — 2022-11-24
- 0.1.0 — 2022-11-23

## README

# IPFS Race
[![NPM](https://img.shields.io/npm/v/ipfs-race.svg)](https://www.npmjs.com/package/ipfs-race)
[![NPM](https://img.shields.io/npm/dt/ipfs-race.svg)](https://www.npmjs.com/package/ipfs-race)
[![GITHUB](https://img.shields.io/github/issues/Frame-One-Software/ipfs-race.svg)](https://github.com/Frame-One-Software/ipfs-race/issues)

Resolve an IPFS path using multiple gateways and methods to get data the fastest.

```bash
npm i ipfs-race
```

```typescript
import {resolve} from "ipfs-race";

resolve("QmaiJczLW9X1Gk7rQH7CgYCuquLZMbdWB6hhqznDBoqdLE")
  .then(({response, urlResolvedFrom}) => {
    console.log("received data first from: ", urlResolvedFrom);
    console.log("data: ", await response.json());
  })
  .catch(console.error);
```

## Node-Fetch Support
If using this library in `<16.x.x` versions of node on a backend and not a browser, then you will need to use [node-fetch](https://www.npmjs.com/package/node-fetch). However, only versions `<=2.6.6` will work automatically. If you are using `>2.6.6` then you will need to pass in your fetch function manually.

```typescript
import {resolve} from "ipfs-race";
import fetch from "node-fetch";

resolve("QmaiJczLW9X1Gk7rQH7CgYCuquLZMbdWB6hhqznDBoqdLE", {fetchOverride: fetch})
  .then(...)
  .catch(console.error);
```

---
_Source: https://npm.io/package/ipfs-race · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
