Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-gateway-race

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-gateway-race

Races given IPFS Gateways to resolve provided CID

  • 1.6.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-91.67%
Maintainers
0
Weekly downloads
 
Created
Source

ipfs-gateway-race

Install

npm install ipfs-gateway-race

Usage

Import the library in your application and create a gateway racer like:

import { createGatewayRacer } from 'ipfs-gateway-race'

const gwRacer = createGatewayRacer(
  ['https://ipfs.io', 'https://cf-ipfs.com']
)

Get

Get a IPFS response by given CID.

interface IpfsGatewayRaceGetOptions {
  pathname?: string
  headers?: Headers
  noAbortRequestsOnWinner?: boolean
  onRaceEnd?: (gwResponsePromises: GatewayResponsePromise[], winnerResponse: GatewayResponse | undefined) => void
}

get(cid: string, options: IpfsGatewayRaceGetOptions): Promise<Response>

Example:

import { createGatewayRacer } from 'ipfs-gateway-race'

const gwRacer = createGatewayRacer(['https://ipfs.io', 'https://cf-ipfs.com'])

const response = await gwRacer.get(
  'bafybeiedv7sowwxamly4oicivudp45rsfvbklnf3fvbvonxrwoxqylhtwq',
  { pathname: '/0.json' }
)

Contributing

Feel free to join in. All welcome. Open an issue!

If you're opening a pull request, please see the guidelines in DEVELOPMENT.md on structuring your commit messages so that your PR will be compatible with our release process.

License

Dual-licensed under MIT + Apache 2.0

Keywords

FAQs

Package last updated on 25 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc