This repository has been archived by the owner on Mar 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Provide access to bundled libraries when in browser
- Loading branch information
1 parent
0e1ad8d
commit 164a133
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
TYPES API | ||
======= | ||
|
||
A set of data types are exposed directly from the IPFS instance under `ipfs.types`. That way you're not required to import/require the following. | ||
|
||
- [`ipfs.types.Buffer`](https://www.npmjs.com/package/buffer) | ||
- [`ipfs.types.PeerId`](https://github.com/libp2p/js-peer-id) | ||
- [`ipfs.types.PeerInfo`](https://github.com/libp2p/js-peer-info) | ||
- [`ipfs.types.multiaddr`](https://github.com/multiformats/js-multiaddr) | ||
- [`ipfs.types.multibase`](https://github.com/multiformats/multibase) | ||
- [`ipfs.types.multihash`](https://github.com/multiformats/js-multihash) | ||
- [`ipfs.types.CID`](https://github.com/ipld/js-cid) | ||
- [`ipfs.types.crypto`](https://github.com/libp2p/js-libp2p-crypto) | ||
- [`ipfs.types.dagPB`](https://github.com/ipld/js-ipld-dag-pb) | ||
- [`ipfs.types.dagCBOR`](https://github.com/ipld/js-ipld-dag-cbor) | ||
- [`ipfs.types.isIPFS`](https://github.com/ipfs-shipyard/is-ipfs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const PeerId = require('peer-id') | ||
const PeerInfo = require('peer-info') | ||
const dagCBOR = require('ipld-dag-cbor') | ||
const dagPB = require('ipld-dag-pb') | ||
const crypto = require('libp2p-crypto') | ||
const isIPFS = require('is-ipfs') | ||
const multiaddr = require('multiaddr') | ||
const multibase = require('multibase') | ||
const multihash = require('multihashes') | ||
const CID = require('cids') | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
|
||
describe('.types', function () { | ||
let ipfs | ||
|
||
before(function (done) { | ||
// CI takes longer to instantiate the daemon, so we need to increase the | ||
// timeout for the before step | ||
this.timeout(60 * 1000) | ||
|
||
common.setup((err, factory) => { | ||
expect(err).to.not.exist() | ||
factory.spawnNode((err, node) => { | ||
expect(err).to.not.exist() | ||
ipfs = node | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
after((done) => { | ||
common.teardown(done) | ||
}) | ||
|
||
it('types object', () => { | ||
expect(ipfs.types).to.be.deep.equal({ | ||
Buffer: Buffer, | ||
PeerId: PeerId, | ||
PeerInfo: PeerInfo, | ||
multiaddr: multiaddr, | ||
multibase: multibase, | ||
multihash: multihash, | ||
CID: CID, | ||
crypto: crypto, | ||
dagPB: dagPB, | ||
dagCBOR: dagCBOR, | ||
isIPFS: isIPFS | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters