0.2.3 • Published 2 months ago

ipfs-race v0.2.3

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
2 months ago

IPFS Race

NPM NPM GITHUB

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

npm i ipfs-race
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. 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.

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

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

2 months ago

0.2.2

7 months ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago