diff --git a/README.md b/README.md index 4009e5b9f6..7bb2afbd21 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/package.json b/package.json index 737ef9cbad..629134823e 100644 --- a/package.json +++ b/package.json @@ -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", @@ -294,4 +295,4 @@ "Łukasz Magiera ", "Максим Ильин " ] -} +} \ No newline at end of file diff --git a/src/core/index.js b/src/core/index.js index e43992a76f..8248a21765 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -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') @@ -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) diff --git a/test/core/exports.spec.js b/test/core/exports.spec.js index 795f2649b1..e1801be56d 100644 --- a/test/core/exports.spec.js +++ b/test/core/exports.spec.js @@ -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') @@ -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) })