@crossbell/ipfs-fetch
⚡ Fetch IPFS contents through the fastest gateway by sending requests to multiple gateways simultaneously.
Try on CodeSandbox.
Installation
yarn add @crossbell/ipfs-fetch
Or via npm:
npm install @crossbell/ipfs-fetch --save
pnpm add @crossbell/ipfs-fetch
Examples
Basic fetch
import { ipfsFetch } from '@crossbell/ipfs-fetch'
ipfsFetch('ipfs://bafkreic5k3zvarbsondfrowy7kpbj6xo7cj25hobksgileqbbupjvvmkoq')
Custom gateways
import { ipfsFetch, IpfsGatewayTemplate } from '@crossbell/ipfs-fetch'
const gateways: IpfsGatewayTemplate[] = [
'https://{cid}.ipfs.cf-ipfs.com/{pathToResource}',
'https://ipfs.io/ipfs/{cid}{pathToResource}',
]
ipfsFetch('ipfs://bafkreic5k3zvarbsondfrowy7kpbj6xo7cj25hobksgileqbbupjvvmkoq', {
gateways,
})