Exports a createHeliaHTTP function that returns an object that implements a lightweight version of the Helia API that functions only over HTTP.
createHeliaHTTP
By default, content and peer routing are requests are resolved using the Delegated HTTP Routing API and blocks are fetched from Trustless Gateways.
Pass it to other modules like @helia/unixfs to fetch files from the distributed web.
import { createHeliaHTTP } from '@helia/http'import { unixfs } from '@helia/unixfs'import { CID } from 'multiformats/cid'const helia = await createHeliaHTTP()const fs = unixfs(helia)fs.cat(CID.parse('bafyFoo')) Copy
import { createHeliaHTTP } from '@helia/http'import { unixfs } from '@helia/unixfs'import { CID } from 'multiformats/cid'const helia = await createHeliaHTTP()const fs = unixfs(helia)fs.cat(CID.parse('bafyFoo'))
import { createHeliaHTTP } from '@helia/http'import { trustlessGateway } from '@helia/block-brokers'import { delegatedHTTPRouting, httpGatewayRouting } from '@helia/routers'import { unixfs } from '@helia/unixfs'import { CID } from 'multiformats/cid'const helia = await createHeliaHTTP({ blockBrokers: [ trustlessGateway() ], routers: [ delegatedHTTPRouting('https://delegated-ipfs.dev'), httpGatewayRouting({ gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io'] }) ]})const fs = unixfs(helia)fs.cat(CID.parse('bafyFoo')) Copy
import { createHeliaHTTP } from '@helia/http'import { trustlessGateway } from '@helia/block-brokers'import { delegatedHTTPRouting, httpGatewayRouting } from '@helia/routers'import { unixfs } from '@helia/unixfs'import { CID } from 'multiformats/cid'const helia = await createHeliaHTTP({ blockBrokers: [ trustlessGateway() ], routers: [ delegatedHTTPRouting('https://delegated-ipfs.dev'), httpGatewayRouting({ gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io'] }) ]})const fs = unixfs(helia)fs.cat(CID.parse('bafyFoo'))
Exports a
createHeliaHTTP
function that returns an object that implements a lightweight version of the Helia API that functions only over HTTP.By default, content and peer routing are requests are resolved using the Delegated HTTP Routing API and blocks are fetched from Trustless Gateways.
Pass it to other modules like @helia/unixfs to fetch files from the distributed web.
Example
Example: with custom gateways and delegated routing endpoints