This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Expand file tree Collapse file tree 4 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -459,8 +459,18 @@ A set of data types are exposed directly from the IPFS instance under `ipfs.type
459459- [` ipfs .types .PeerId ` ](https://github.com/libp2p/js-peer-id)
460460- [` ipfs .types .PeerInfo ` ](https://github.com/libp2p/js-peer-info)
461461- [` ipfs .types .multiaddr ` ](https://github.com/multiformats/js-multiaddr)
462+ - [` ipfs .types .multibase ` ](https://github.com/multiformats/multibase)
462463- [` ipfs .types .multihash ` ](https://github.com/multiformats/js-multihash)
463464- [` ipfs .types .CID ` ](https://github.com/ipld/js-cid)
465+ - [` ipfs .types .dagPB ` ](https://github.com/ipld/js-ipld-dag-pb)
466+ - [` ipfs .types .dagCBOR ` ](https://github.com/ipld/js-ipld-dag-cbor)
467+
468+ #### ` Util`
469+
470+ 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:
471+
472+ - [` ipfs .util .crypto ` ](https://github.com/libp2p/js-libp2p-crypto)
473+ - [` ipfs .util .isIPFS ` ](https://github.com/ipfs-shipyard/is-ipfs)
464474
465475## FAQ
466476
Original file line number Diff line number Diff line change 113113 "ipfs-multipart" : " ~0.1.0" ,
114114 "ipfs-repo" : " ^0.20.0" ,
115115 "ipfs-unixfs" : " ~0.1.14" ,
116+ "ipld-dag-cbor" : " ^0.12.0" ,
117+ "ipld-dag-pb" : " ^0.13.1" ,
116118 "ipfs-unixfs-engine" : " ~0.29.0" ,
117119 "ipld" : " ^0.17.0" ,
118120 "is-ipfs" : " ^0.3.2" ,
141143 "mafmt" : " ^6.0.0" ,
142144 "mime-types" : " ^2.1.18" ,
143145 "mkdirp" : " ~0.5.1" ,
146+ "multibase" : " ^0.4.0" ,
144147 "multiaddr" : " ^5.0.0" ,
145148 "multihashes" : " ~0.4.13" ,
146149 "once" : " ^1.4.0" ,
Original file line number Diff line number Diff line change @@ -4,9 +4,14 @@ const BlockService = require('ipfs-block-service')
44const Ipld = require ( 'ipld' )
55const PeerId = require ( 'peer-id' )
66const 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' )
711const multiaddr = require ( 'multiaddr' )
812const multihash = require ( 'multihashes' )
913const PeerBook = require ( 'peer-book' )
14+ const multibase = require ( 'multibase' )
1015const CID = require ( 'cids' )
1116const debug = require ( 'debug' )
1217const extend = require ( 'deep-extend' )
@@ -58,8 +63,11 @@ class IPFS extends EventEmitter {
5863 PeerId : PeerId ,
5964 PeerInfo : PeerInfo ,
6065 multiaddr : multiaddr ,
66+ multibase : multibase ,
6167 multihash : multihash ,
62- CID : CID
68+ CID : CID ,
69+ dagPB : dagPB ,
70+ dagCBOR : dagCBOR
6371 }
6472
6573 // IPFS Core Internals
@@ -120,6 +128,12 @@ class IPFS extends EventEmitter {
120128 this . lsReadableStream = this . files . lsReadableStreamImmutable
121129 this . lsPullStream = this . files . lsPullStreamImmutable
122130
131+ // ipfs.util
132+ this . util = {
133+ crypto : crypto ,
134+ isIPFS : isIPFS
135+ }
136+
123137 boot ( this )
124138 }
125139}
Original file line number Diff line number Diff line change @@ -10,7 +10,12 @@ const isNode = require('detect-node')
1010const hat = require ( 'hat' )
1111const PeerId = require ( 'peer-id' )
1212const 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' )
1317const multiaddr = require ( 'multiaddr' )
18+ const multibase = require ( 'multibase' )
1419const multihash = require ( 'multihashes' )
1520const CID = require ( 'cids' )
1621const IPFS = require ( '../../src/core' )
@@ -101,8 +106,18 @@ describe('init', () => {
101106 PeerId : PeerId ,
102107 PeerInfo : PeerInfo ,
103108 multiaddr : multiaddr ,
109+ multibase : multibase ,
104110 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
106121 } )
107122 } )
108123} )
You can’t perform that action at this time.
0 commit comments