Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Created February 7, 2024 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SgtPooki/357cee34939e40c8d0d7cf0e63aff8ba to your computer and use it in GitHub Desktop.
Save SgtPooki/357cee34939e40c8d0d7cf0e63aff8ba to your computer and use it in GitHub Desktop.
@helia/verified-fetch test script
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