Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: provide access to multicodec (#1921)
Browse files Browse the repository at this point in the history
resolves #1913

License: MIT
Signed-off by: Nitin Patel <[email protected]>
  • Loading branch information
niinpatel authored and Alan Shaw committed Mar 13, 2019
1 parent 826fed6 commit ceec0bc
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ Aside from the default export, `ipfs` exports various types and utilities that a
- [`multiaddr`](https://www.npmjs.com/package/multiaddr)
- [`multibase`](https://www.npmjs.com/package/multibase)
- [`multihash`](https://www.npmjs.com/package/multihash)
- [`multicodec`](https://www.npmjs.com/package/multicodec)
- [`CID`](https://www.npmjs.com/package/cids)
These can be accessed like this, for example:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
"multiaddr": "^6.0.0",
"multiaddr-to-uri": "^4.0.1",
"multibase": "~0.6.0",
"multicodec": "~0.5.0",
"multihashes": "~0.4.14",
"multihashing-async": "~0.5.1",
"node-fetch": "^2.3.0",
Expand Down Expand Up @@ -294,4 +295,4 @@
"Łukasz Magiera <[email protected]>",
"Максим Ильин <[email protected]>"
]
}
}
3 changes: 2 additions & 1 deletion src/core/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const multiaddr = require('multiaddr')
const multihash = require('multihashes')
const PeerBook = require('peer-book')
const multibase = require('multibase')
const multicodec = require('multicodec')
const CID = require('cids')
const debug = require('debug')
const defaultsDeep = require('@nodeutils/defaults-deep')
Expand Down Expand Up @@ -175,7 +176,7 @@ class IPFS extends EventEmitter {

module.exports = IPFS

Object.assign(module.exports, { crypto, isIPFS, Buffer, CID, multiaddr, multibase, multihash, PeerId, PeerInfo })
Object.assign(module.exports, { crypto, isIPFS, Buffer, CID, multiaddr, multibase, multihash, multicodec, PeerId, PeerInfo })

module.exports.createNode = (options) => {
return new IPFS(options)
Expand Down
2 changes: 2 additions & 0 deletions test/core/exports.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const CID = require('cids')
const multiaddr = require('multiaddr')
const multibase = require('multibase')
const multihash = require('multihashes')
const multicodec = require('multicodec')
const PeerId = require('peer-id')
const PeerInfo = require('peer-info')
const chai = require('chai')
Expand All @@ -25,6 +26,7 @@ describe('exports', () => {
expect(Ipfs.multiaddr).to.equal(multiaddr)
expect(Ipfs.multibase).to.equal(multibase)
expect(Ipfs.multihash).to.equal(multihash)
expect(Ipfs.multicodec).to.equal(multicodec)
expect(Ipfs.PeerId).to.equal(PeerId)
expect(Ipfs.PeerInfo).to.equal(PeerInfo)
})
Expand Down

0 comments on commit ceec0bc

Please sign in to comment.