1.0.1 • Published 11 months ago
ping-ipfs-gateway v1.0.1
ping ipfs gateway
This package helps to ping working IPFS gateway and returns it. Initially, it was made to check videos and replace broken links.
Set up
npm i ping-ipfs-gateway
const pingIPFS = require('ping-ipfs-gateway')
How to use
Use as a simple function.
pingIPFS()
Parameters
There are three function parameters:
- CONFIG - config with all possible gateways. Optional parameter.
Default config:
[
'https://ipfs.io/ipfs/',
'https://crustipfs.live/ipfs/',
'https://crustipfs.info/ipfs/',
'https://gateway.pinata.cloud/ipfs/',
'https://gw.crust-gateway.com/ipfs/',
'https://gw.crust-gateway.xyz/ipfs/',
'https://gw.crust-gateway.cc/ipfs/'
]
- DEFAULT SOURCE to use in IPFS request and to make sure currently tested gateway works. Optional parameter.
Default - QmXCFbH7taH5WDBZa9MiFp4oVBFz2rtUupWCNTib69FP1Y
- TIMEOUT. If you want to specify request timeout. Optional parameter.
Default - 8000
Example:
Your function can look something like that:
await pingIPFS(config, 'QmYd1Mh2VHVyF3WgvFsN3NFkozXscnCVmEV2YG86UKtK3C')