@helia/http 0.9.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,6 +15,8 @@
15
15
 
16
16
  Exports a `createHeliaHTTP` function that returns an object that implements a lightweight version of the Helia API that functions only over HTTP.
17
17
 
18
+ 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/).
19
+
18
20
  Pass it to other modules like @helia/unixfs to fetch files from the distributed web.
19
21
 
20
22
  ## Example
@@ -30,6 +32,30 @@ const fs = unixfs(helia)
30
32
  fs.cat(CID.parse('bafyFoo'))
31
33
  ```
32
34
 
35
+ ## Example - with custom gateways and delegated routing endpoints
36
+
37
+ ```typescript
38
+ import { createHeliaHTTP } from '@helia/http'
39
+ import { trustlessGateway } from '@helia/block-brokers'
40
+ import { delegatedHTTPRouting } from '@helia/routers'
41
+ import { unixfs } from '@helia/unixfs'
42
+ import { CID } from 'multiformats/cid'
43
+
44
+ const helia = await createHeliaHTTP({
45
+ blockBrokers: [
46
+ trustlessGateway({
47
+ gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io'],
48
+ }),
49
+ ],
50
+ routers: [
51
+ delegatedHTTPRouting('https://delegated-ipfs.dev')
52
+ ]
53
+ })
54
+
55
+ const fs = unixfs(helia)
56
+ fs.cat(CID.parse('bafyFoo'))
57
+ ```
58
+
33
59
  # Install
34
60
 
35
61
  ```console