@crossbell/ipfs-fetch
TypeScript icon, indicating that this package has built-in type declarations

0.0.21 • Public • Published

@crossbell/ipfs-fetch

GitHub license NPM version Bundle size

⚡ Fetch IPFS contents through the fastest gateway by sending requests to multiple gateways simultaneously. Try on CodeSandbox.

Installation

Using yarn:
yarn add @crossbell/ipfs-fetch
Or via npm:
npm install @crossbell/ipfs-fetch --save
Or via pnpm:
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'

// Default gateways: https://github.com/Crossbell-Box/crossbell-ipfs-utils/blob/main/packages/ipfs-fetch/src/constant.ts
const gateways: IpfsGatewayTemplate[] = [
  'https://{cid}.ipfs.cf-ipfs.com/{pathToResource}',
  'https://ipfs.io/ipfs/{cid}{pathToResource}',
]

ipfsFetch('ipfs://bafkreic5k3zvarbsondfrowy7kpbj6xo7cj25hobksgileqbbupjvvmkoq', {
  gateways,
})

/@crossbell/ipfs-fetch/

    Package Sidebar

    Install

    npm i @crossbell/ipfs-fetch

    Weekly Downloads

    269

    Version

    0.0.21

    License

    MIT

    Unpacked Size

    43.4 kB

    Total Files

    28

    Last publish

    Collaborators

    • songkeys
    • runjuu