Created
February 7, 2024 20:03
-
-
Save SgtPooki/357cee34939e40c8d0d7cf0e63aff8ba to your computer and use it in GitHub Desktop.
@helia/verified-fetch test script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { trustlessGateway } from '@helia/block-brokers' | |
import { createHeliaHTTP } from '@helia/http' | |
import { delegatedHTTPRouting } from '@helia/routers' | |
import { createVerifiedFetch } from '@helia/verified-fetch' | |
const helia = await createHeliaHTTP({ | |
blockBrokers: [ | |
trustlessGateway({ | |
gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io', 'https://trustless-gateway.link'] | |
}) | |
], | |
routers: [ | |
delegatedHTTPRouting('https://delegated-ipfs.dev') | |
] | |
}) | |
const fetch = await createVerifiedFetch(helia) | |
const response = await fetch('ipns://helia-identify.on.fleek.co/index.html') | |
// const response = await fetch('ipfs://QmbxpRxwKXxnJQjnPqm1kzDJSJ8YgkLxH23mcZURwPHjGv/index.html') | |
const text = await response.text() | |
// eslint-disable-next-line no-console | |
console.log(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment