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

0.0.20 • Public • Published

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

Examples

Basic fetch
import { ipfsFetch } from '@zinde/ipfs-fetch'

ipfsFetch('ipfs://bafkreic5k3zvarbsondfrowy7kpbj6xo7cj25hobksgileqbbupjvvmkoq')
Custom gateways
import { ipfsFetch, IpfsGatewayTemplate } from '@zinde/ipfs-fetch'

// Default gateways: https://github.com/zinde-social/zinde-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,
})

Readme

Keywords

none

Package Sidebar

Install

npm i @zinde/ipfs-fetch

Weekly Downloads

0

Version

0.0.20

License

MIT

Unpacked Size

40.6 kB

Total Files

25

Last publish

Collaborators

  • hashbridge