@helia/http 3.1.3 → 3.1.4-1361bfa5
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 +16 -12
- package/dist/index.min.js +21 -118
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +24 -28
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +35 -67
- package/dist/src/index.js.map +1 -1
- package/package.json +9 -17
- package/src/index.ts +39 -79
- package/dist/src/utils/libp2p-defaults.d.ts +0 -9
- package/dist/src/utils/libp2p-defaults.d.ts.map +0 -1
- package/dist/src/utils/libp2p-defaults.js +0 -29
- package/dist/src/utils/libp2p-defaults.js.map +0 -1
- package/dist/src/utils/libp2p.d.ts +0 -19
- package/dist/src/utils/libp2p.d.ts.map +0 -1
- package/dist/src/utils/libp2p.js +0 -19
- package/dist/src/utils/libp2p.js.map +0 -1
- package/dist/typedoc-urls.json +0 -10
- package/src/utils/libp2p-defaults.ts +0 -38
- package/src/utils/libp2p.ts +0 -42
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ repo and examine the changes made.
|
|
|
30
30
|
|
|
31
31
|
-->
|
|
32
32
|
|
|
33
|
-
Exports a `
|
|
33
|
+
Exports a `withHTTP` function configures a Helia node that with block brokers and gateways that only run over HTTP.
|
|
34
34
|
|
|
35
35
|
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/).
|
|
36
36
|
|
|
@@ -39,38 +39,42 @@ Pass it to other modules like @helia/unixfs to fetch files from the distributed
|
|
|
39
39
|
## Example
|
|
40
40
|
|
|
41
41
|
```typescript
|
|
42
|
-
import {
|
|
42
|
+
import { withHTTP } from '@helia/http'
|
|
43
43
|
import { unixfs } from '@helia/unixfs'
|
|
44
|
+
import { createHelia } from 'helia'
|
|
44
45
|
import { CID } from 'multiformats/cid'
|
|
45
46
|
|
|
46
|
-
const helia = await
|
|
47
|
+
const helia = await withHTTP(createHelia()).start()
|
|
47
48
|
|
|
48
49
|
const fs = unixfs(helia)
|
|
49
50
|
fs.cat(CID.parse('bafyFoo'))
|
|
50
51
|
```
|
|
51
52
|
|
|
52
|
-
## Example -
|
|
53
|
+
## Example - without using this module
|
|
54
|
+
|
|
55
|
+
It's possible to manually configure your node without using this module.
|
|
53
56
|
|
|
54
57
|
```typescript
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
+
import { createHelia } from 'helia'
|
|
59
|
+
import { trustlessGatewayBlockBroker } from '@helia/trustless-gateway-client'
|
|
60
|
+
import { fallbackRouter } from '@helia/fallback-router'
|
|
61
|
+
import { delegatedHTTPRouter } from '@helia/delegated-http-routing-client'
|
|
58
62
|
import { unixfs } from '@helia/unixfs'
|
|
59
63
|
import { CID } from 'multiformats/cid'
|
|
60
64
|
|
|
61
|
-
const helia = await
|
|
65
|
+
const helia = await createHelia({
|
|
62
66
|
blockBrokers: [
|
|
63
|
-
|
|
67
|
+
trustlessGatewayBlockBroker()
|
|
64
68
|
],
|
|
65
69
|
routers: [
|
|
66
|
-
|
|
70
|
+
delegatedHTTPRouter({
|
|
67
71
|
url: 'https://delegated-ipfs.dev'
|
|
68
72
|
}),
|
|
69
|
-
|
|
73
|
+
fallbackRouter({
|
|
70
74
|
gateways: ['https://cloudflare-ipfs.com', 'https://ipfs.io']
|
|
71
75
|
})
|
|
72
76
|
]
|
|
73
|
-
})
|
|
77
|
+
}).start()
|
|
74
78
|
|
|
75
79
|
const fs = unixfs(helia)
|
|
76
80
|
fs.cat(CID.parse('bafyFoo'))
|