@helia/libp2p 2.0.0 → 2.1.0-ae012cf9

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
@@ -32,7 +32,7 @@ repo and examine the changes made.
32
32
 
33
33
  Adds libp2p functionality to Helia
34
34
 
35
- ## Example
35
+ ## Example - With default config
36
36
 
37
37
  ```ts
38
38
  import { createHelia } from 'helia'
@@ -43,6 +43,25 @@ const node = await withLibp2p(createHelia()).start()
43
43
  console.info(node.libp2p.peerId) // 12D3Koo...
44
44
  ```
45
45
 
46
+ ## Example - Custom config
47
+
48
+ By default `withLibp2p` configures a libp2p node for the current environment.
49
+
50
+ Any options passed will be merged with the default config.
51
+
52
+ For full control over your node (and the bundle size), use `withLibp2pLight`:
53
+
54
+ ```ts
55
+ import { createHelia } from 'helia'
56
+ import { withLibp2pLight } from '@helia/libp2p'
57
+
58
+ const node = await withLibp2pLight(createHelia(), {
59
+ //... libp2p config here
60
+ }).start()
61
+
62
+ console.info(node.libp2p.peerId) // 12D3Koo...
63
+ ```
64
+
46
65
  # Install
47
66
 
48
67
  ```console