From 67bbef354b26c52327cda4033f93c58b5540c0b0 Mon Sep 17 00:00:00 2001 From: Daniel N <2color@users.noreply.github.com> Date: Tue, 16 Jan 2024 18:11:00 +0100 Subject: [PATCH] chore: generate readmes --- packages/http/README.md | 26 ++++++++++++++++++++++++++ packages/routers/README.md | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/packages/http/README.md b/packages/http/README.md index 722c2a53..c28f1eeb 100644 --- a/packages/http/README.md +++ b/packages/http/README.md @@ -15,6 +15,8 @@ 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](https://specs.ipfs.tech/routing/http-routing-v1/) and blocks are fetched from [Trustless Gateways](https://specs.ipfs.tech/http-gateways/trustless-gateway/). + Pass it to other modules like @helia/unixfs to fetch files from the distributed web. ## Example @@ -30,6 +32,30 @@ const fs = unixfs(helia) fs.cat(CID.parse('bafyFoo')) ``` +## Example - with custom gateways and delegated routing endpoints + +```typescript +import { createHeliaHTTP } from '@helia/http' +import { trustlessGateway } from '@helia/block-brokers' +import { delegatedHTTPRouting } from '@helia/routers' +import { unixfs } from '@helia/unixfs' +import { CID } from 'multiformats/cid' + +const helia = await createHeliaHTTP({ + blockBrokers: [ + trustlessGateway({ + gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io'], + }), + ], + routers: [ + delegatedHTTPRouting('https://delegated-ipfs.dev') + ] +}) + +const fs = unixfs(helia) +fs.cat(CID.parse('bafyFoo')) +``` + # Install ```console diff --git a/packages/routers/README.md b/packages/routers/README.md index d52a8ff2..22378715 100644 --- a/packages/routers/README.md +++ b/packages/routers/README.md @@ -11,6 +11,10 @@ > Routers for Helia +# About + +Abstraction layer over different content and peer routing mechanisms. + # Install ```console