This repository was archived by the owner on Feb 12, 2024. It is now read-only.
Commit 180db8c 1 parent 192e5d2 commit 180db8c Copy full SHA for 180db8c
File tree 4 files changed +44
-2
lines changed
4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -455,8 +455,18 @@ A set of data types are exposed directly from the IPFS instance under `ipfs.type
455
455
- [` ipfs .types .PeerId ` ](https://github.com/libp2p/js-peer-id)
456
456
- [` ipfs .types .PeerInfo ` ](https://github.com/libp2p/js-peer-info)
457
457
- [` ipfs .types .multiaddr ` ](https://github.com/multiformats/js-multiaddr)
458
+ - [` ipfs .types .multibase ` ](https://github.com/multiformats/multibase)
458
459
- [` ipfs .types .multihash ` ](https://github.com/multiformats/js-multihash)
459
460
- [` ipfs .types .CID ` ](https://github.com/ipld/js-cid)
461
+ - [` ipfs .types .dagPB ` ](https://github.com/ipld/js-ipld-dag-pb)
462
+ - [` ipfs .types .dagCBOR ` ](https://github.com/ipld/js-ipld-dag-cbor)
463
+
464
+ #### ` Util`
465
+
466
+ 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:
467
+
468
+ - [` ipfs .util .crypto ` ](https://github.com/libp2p/js-libp2p-crypto)
469
+ - [` ipfs .util .isIPFS ` ](https://github.com/ipfs-shipyard/is-ipfs)
460
470
461
471
## FAQ
462
472
Original file line number Diff line number Diff line change 113
113
"ipfs-multipart" : " ~0.1.0" ,
114
114
"ipfs-repo" : " ^0.20.0" ,
115
115
"ipfs-unixfs" : " ~0.1.14" ,
116
+ "ipld-dag-cbor" : " ^0.12.0" ,
117
+ "ipld-dag-pb" : " ^0.13.1" ,
116
118
"ipfs-unixfs-engine" : " ~0.29.0" ,
117
119
"ipld" : " ^0.17.0" ,
118
120
"is-ipfs" : " ^0.3.2" ,
141
143
"mafmt" : " ^6.0.0" ,
142
144
"mime-types" : " ^2.1.18" ,
143
145
"mkdirp" : " ~0.5.1" ,
146
+ "multibase" : " ^0.4.0" ,
144
147
"multiaddr" : " ^5.0.0" ,
145
148
"multihashes" : " ~0.4.13" ,
146
149
"once" : " ^1.4.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