You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: docs/DAEMON.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ The IPFS Daemon exposes the API defined in the [HTTP API spec](https://docs.ipfs
23
23
If you want a programmatic way to spawn a IPFS Daemon using JavaScript, check out the [ipfsd-ctl](https://github.com/ipfs/js-ipfsd-ctl) module.
24
24
25
25
```javascript
26
-
const { createFactory } =require('ipfsd-ctl')
26
+
import { createFactory } from'ipfsd-ctl'
27
27
constfactory=createFactory({
28
28
type:'proc'// or 'js' to run in a separate process
Copy file name to clipboardExpand all lines: docs/IPLD.md
+22-16Lines changed: 22 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,38 +49,41 @@ If your application requires support for extra codecs, you can configure them as
49
49
1. Configure the [IPLD layer](https://github.com/ipfs/js-ipfs/blob/master/packages/ipfs/docs/MODULE.md#optionsipld) of your IPFS daemon to support the codec. This step is necessary so the node knows how to prepare data received over HTTP to be passed to IPLD for serialization:
50
50
51
51
```javascript
52
-
constipfs=require('ipfs')
52
+
import { create } from'ipfs'
53
+
importcustomBlockCodecfrom'custom-blockcodec'
54
+
importcustomMultibasefrom'custom-multibase'
55
+
importcustomMultihasherfrom'custom-multihasher'
53
56
54
-
constnode=awaitipfs({
57
+
constnode=awaitcreate({
55
58
ipld: {
56
59
// either specify BlockCodecs as part of the `codecs` list
57
60
codecs: [
58
-
require('custom-blockcodec')
61
+
customBlockCodec
59
62
],
60
63
61
64
// and/or supply a function to load them dynamically
62
65
loadCodec:async (codecNameOrCode) => {
63
-
returnrequire(codecNameOrCode)
66
+
returnimport(codecNameOrCode)
64
67
},
65
68
66
69
// either specify Multibase codecs as part of the `bases` list
67
70
bases: [
68
-
require('custom-multibase')
71
+
customMultibase
69
72
],
70
73
71
74
// and/or supply a function to load them dynamically
72
75
loadBase:async (baseNameOrCode) => {
73
-
returnrequire(baseNameOrCode)
76
+
returnimport(baseNameOrCode)
74
77
},
75
78
76
79
// either specify Multihash hashers as part of the `hashers` list
77
80
hashers: [
78
-
require('custom-multibase')
81
+
customMultihasher
79
82
],
80
83
81
84
// and/or supply a function to load them dynamically
82
85
loadHasher:async (hashNameOrCode) => {
83
-
returnrequire(hashNameOrCode)
86
+
returnimport(hashNameOrCode)
84
87
}
85
88
}
86
89
})
@@ -89,39 +92,42 @@ If your application requires support for extra codecs, you can configure them as
89
92
2. Configure your IPFS HTTP API Client to support the codec. This is necessary so that the client can send the data to the IPFS node over HTTP:
90
93
91
94
```javascript
92
-
constipfsHttpClient=require('ipfs-http-client')
95
+
import { create } from'ipfs-http-client'
96
+
importcustomBlockCodecfrom'custom-blockcodec'
97
+
importcustomMultibasefrom'custom-multibase'
98
+
importcustomMultihasherfrom'custom-multihasher'
93
99
94
-
constclient=ipfsHttpClient({
100
+
constclient=create({
95
101
url:'http://127.0.0.1:5002',
96
102
ipld: {
97
103
// either specify BlockCodecs as part of the `codecs` list
98
104
codecs: [
99
-
require('custom-blockcodec')
105
+
customBlockCodec
100
106
],
101
107
102
108
// and/or supply a function to load them dynamically
103
109
loadCodec:async (codecNameOrCode) => {
104
-
returnrequire(codecNameOrCode)
110
+
returnimport(codecNameOrCode)
105
111
},
106
112
107
113
// either specify Multibase codecs as part of the `bases` list
108
114
bases: [
109
-
require('custom-multibase')
115
+
customMultibase
110
116
],
111
117
112
118
// and/or supply a function to load them dynamically
113
119
loadBase:async (baseNameOrCode) => {
114
-
returnrequire(baseNameOrCode)
120
+
returnimport(baseNameOrCode)
115
121
},
116
122
117
123
// either specify Multihash hashers as part of the `hashers` list
118
124
hashers: [
119
-
require('custom-multibase')
125
+
customMultihasher
120
126
],
121
127
122
128
// and/or supply a function to load them dynamically
0 commit comments