@helia/verified-fetch 1.3.13 → 1.4.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
@@ -40,6 +40,8 @@ A `verifiedFetch` function is exported to get up and running quickly, and a `cre
40
40
 
41
41
  Browser-cache-friendly [Response](https://developer.mozilla.org/en-US/docs/Web/API/Response) objects are returned which should be instantly familiar to web developers.
42
42
 
43
+ Learn more in the [announcement blog post](https://blog.ipfs.tech/verified-fetch/) and check out the [ready-to-run example](https://github.com/ipfs-examples/helia-examples/tree/main/examples/helia-browser-verified-fetch).
44
+
43
45
  You may use any supported resource argument to fetch content:
44
46
 
45
47
  - [CID](https://multiformats.github.io/js-multiformats/classes/cid.CID.html) instance
@@ -117,22 +119,25 @@ For full control of how `@helia/verified-fetch` fetches content from the distrib
117
119
 
118
120
  The [helia](https://www.npmjs.com/package/helia) module is configured with a libp2p node that is suited for decentralized applications, alternatively [@helia/http](https://www.npmjs.com/package/@helia/http) is available which uses HTTP gateways for all network operations.
119
121
 
120
- See variations of [Helia and js-libp2p configuration options](https://helia.io/interfaces/helia.HeliaInit.html)
122
+ You can see variations of Helia and js-libp2p configuration options at <https://helia.io/interfaces/helia.index.HeliaInit.html>.
121
123
 
122
124
  ```typescript
123
125
  import { trustlessGateway } from '@helia/block-brokers'
124
126
  import { createHeliaHTTP } from '@helia/http'
125
- import { delegatedHTTPRouting } from '@helia/routers'
127
+ import { delegatedHTTPRouting, httpGatewayRouting } from '@helia/routers'
126
128
  import { createVerifiedFetch } from '@helia/verified-fetch'
127
129
 
128
130
  const fetch = await createVerifiedFetch(
129
131
  await createHeliaHTTP({
130
132
  blockBrokers: [
131
- trustlessGateway({
133
+ trustlessGateway()
134
+ ],
135
+ routers: [
136
+ delegatedHTTPRouting('http://delegated-ipfs.dev'),
137
+ httpGatewayRouting({
132
138
  gateways: ['https://mygateway.example.net', 'https://trustless-gateway.link']
133
139
  })
134
- ],
135
- routers: ['http://delegated-ipfs.dev'].map((routerUrl) => delegatedHTTPRouting(routerUrl))
140
+ ]
136
141
  })
137
142
  )
138
143
 
@@ -615,7 +620,7 @@ Known Errors that can be thrown:
615
620
  1. `TypeError` - If the resource argument is not a string, CID, or CID string.
616
621
  2. `TypeError` - If the options argument is passed and not an object.
617
622
  3. `TypeError` - If the options argument is passed and is malformed.
618
- 4. `AbortError` - If the content request is aborted due to user aborting provided AbortSignal.
623
+ 4. `AbortError` - If the content request is aborted due to user aborting provided AbortSignal. Note that this is a `AbortError` from `@libp2p/interface` and not the standard `AbortError` from the Fetch API.
619
624
 
620
625
  # Install
621
626