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 299
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 (#732)
Close #406
- Loading branch information
1 parent
9c37213
commit 994bdad
Showing
7 changed files
with
124 additions
and
3 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
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,22 @@ | ||
'use strict' | ||
|
||
const CID = require('cids') | ||
const dagCBOR = require('ipld-dag-cbor') | ||
const dagPB = require('ipld-dag-pb') | ||
const multiaddr = require('multiaddr') | ||
const multibase = require('multibase') | ||
const multihash = require('multihashes') | ||
const PeerId = require('peer-id') | ||
const PeerInfo = require('peer-info') | ||
|
||
module.exports = () => ({ | ||
Buffer: Buffer, | ||
CID: CID, | ||
dagPB: dagPB, | ||
dagCBOR: dagCBOR, | ||
multiaddr: multiaddr, | ||
multibase: multibase, | ||
multihash: multihash, | ||
PeerId: PeerId, | ||
PeerInfo: PeerInfo | ||
}) |
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,52 @@ | ||
/* 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 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) | ||
|
||
const IPFSApi = require('../src') | ||
|
||
const f = require('./utils/factory') | ||
|
||
describe('.types', function () { | ||
this.timeout(20 * 1000) | ||
|
||
let ipfsd | ||
let ipfs | ||
|
||
before((done) => { | ||
f.spawn({ initOptions: { bits: 1024 } }, (err, _ipfsd) => { | ||
expect(err).to.not.exist() | ||
ipfsd = _ipfsd | ||
ipfs = IPFSApi(_ipfsd.apiAddr) | ||
done() | ||
}) | ||
}) | ||
|
||
after((done) => ipfsd.stop(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, | ||
dagPB: dagPB, | ||
dagCBOR: dagCBOR | ||
}) | ||
}) | ||
}) |
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