This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Commit 7861794 1 parent e189b72 commit 7861794 Copy full SHA for 7861794
File tree 4 files changed +45
-2
lines changed
4 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -366,8 +366,18 @@ A set of data types are exposed directly from the IPFS instance under `ipfs.type
366
366
- [ ` ipfs.types.PeerId ` ] ( https://github.com/libp2p/js-peer-id )
367
367
- [ ` ipfs.types.PeerInfo ` ] ( https://github.com/libp2p/js-peer-info )
368
368
- [ ` ipfs.types.multiaddr ` ] ( https://github.com/multiformats/js-multiaddr )
369
+ - [ ` ipfs.types.multibase ` ] ( https://github.com/multiformats/multibase )
369
370
- [ ` ipfs.types.multihash ` ] ( https://github.com/multiformats/js-multihash )
370
371
- [ ` ipfs.types.CID ` ] ( https://github.com/ipld/js-cid )
372
+ - [ ` ipfs.types.dagPB ` ] ( https://github.com/ipld/js-ipld-dag-pb )
373
+ - [ ` ipfs.types.dagCBOR ` ] ( https://github.com/ipld/js-ipld-dag-cbor )
374
+
375
+ #### ` Util `
376
+
377
+ A set of utils are exposed directly from the IPFS instance under ` ipfs.util ` . That way you're not required to import/require the following:
378
+
379
+ - [ ` ipfs.util.crypto ` ] ( https://github.com/libp2p/js-libp2p-crypto )
380
+ - [ ` ipfs.util.isIPFS ` ] ( https://github.com/ipfs-shipyard/is-ipfs )
371
381
372
382
## FAQ
373
383
Original file line number Diff line number Diff line change 115
115
"ipfs-unixfs" : " ~0.1.14" ,
116
116
"ipfs-unixfs-engine" : " ~0.27.0" ,
117
117
"ipld" : " ^0.15.0" ,
118
+ "ipld-dag-cbor" : " ^0.12.0" ,
119
+ "ipld-dag-pb" : " ^0.13.1" ,
118
120
"is-ipfs" : " ^0.3.2" ,
119
121
"is-stream" : " ^1.1.0" ,
120
122
"joi" : " ^13.1.2" ,
121
123
"joi-browser" : " ^13.0.1" ,
122
124
"joi-multiaddr" : " ^1.0.1" ,
123
125
"libp2p" : " ~0.19.2" ,
124
126
"libp2p-circuit" : " ~0.1.5" ,
127
+ "libp2p-crypto" : " ^0.12.1" ,
125
128
"libp2p-floodsub" : " ~0.14.1" ,
126
129
"libp2p-kad-dht" : " ~0.9.0" ,
127
130
"libp2p-keychain" : " ~0.3.1" ,
141
144
"mime-types" : " ^2.1.18" ,
142
145
"mkdirp" : " ~0.5.1" ,
143
146
"multiaddr" : " ^3.1.0" ,
147
+ "multibase" : " ^0.4.0" ,
144
148
"multihashes" : " ~0.4.13" ,
145
149
"once" : " ^1.4.0" ,
146
150
"path-exists" : " ^3.0.0" ,
Original file line number Diff line number Diff line change @@ -4,9 +4,14 @@ const BlockService = require('ipfs-block-service')
4
4
const Ipld = require ( 'ipld' )
5
5
const PeerId = require ( 'peer-id' )
6
6
const PeerInfo = require ( 'peer-info' )
7
+ const dagCBOR = require ( 'ipld-dag-cbor' )
8
+ const dagPB = require ( 'ipld-dag-pb' )
9
+ const crypto = require ( 'libp2p-crypto' )
10
+ const isIPFS = require ( 'is-ipfs' )
7
11
const multiaddr = require ( 'multiaddr' )
8
12
const multihash = require ( 'multihashes' )
9
13
const PeerBook = require ( 'peer-book' )
14
+ const multibase = require ( 'multibase' )
10
15
const CID = require ( 'cids' )
11
16
const debug = require ( 'debug' )
12
17
const extend = require ( 'deep-extend' )
@@ -58,8 +63,11 @@ class IPFS extends EventEmitter {
58
63
PeerId : PeerId ,
59
64
PeerInfo : PeerInfo ,
60
65
multiaddr : multiaddr ,
66
+ multibase : multibase ,
61
67
multihash : multihash ,
62
- CID : CID
68
+ CID : CID ,
69
+ dagPB : dagPB ,
70
+ dagCBOR : dagCBOR
63
71
}
64
72
65
73
// IPFS Core Internals
@@ -120,6 +128,12 @@ class IPFS extends EventEmitter {
120
128
this . lsReadableStream = this . files . lsReadableStreamImmutable
121
129
this . lsPullStream = this . files . lsPullStreamImmutable
122
130
131
+ // ipfs.util
132
+ this . util = {
133
+ crypto : crypto ,
134
+ isIPFS : isIPFS
135
+ }
136
+
123
137
boot ( this )
124
138
}
125
139
}
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ const isNode = require('detect-node')
10
10
const hat = require ( 'hat' )
11
11
const PeerId = require ( 'peer-id' )
12
12
const PeerInfo = require ( 'peer-info' )
13
+ const dagCBOR = require ( 'ipld-dag-cbor' )
14
+ const dagPB = require ( 'ipld-dag-pb' )
15
+ const crypto = require ( 'libp2p-crypto' )
16
+ const isIPFS = require ( 'is-ipfs' )
13
17
const multiaddr = require ( 'multiaddr' )
18
+ const multibase = require ( 'multibase' )
14
19
const multihash = require ( 'multihashes' )
15
20
const CID = require ( 'cids' )
16
21
const IPFS = require ( '../../src/core' )
@@ -101,8 +106,18 @@ describe('init', () => {
101
106
PeerId : PeerId ,
102
107
PeerInfo : PeerInfo ,
103
108
multiaddr : multiaddr ,
109
+ multibase : multibase ,
104
110
multihash : multihash ,
105
- CID : CID
111
+ CID : CID ,
112
+ dagPB : dagPB ,
113
+ dagCBOR : dagCBOR
114
+ } )
115
+ } )
116
+
117
+ it ( 'util' , ( ) => {
118
+ expect ( ipfs . util ) . to . be . deep . equal ( {
119
+ crypto : crypto ,
120
+ isIPFS : isIPFS
106
121
} )
107
122
} )
108
123
} )
You can’t perform that action at this time.
0 commit comments