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 db83b50
Showing
6 changed files
with
120 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,14 @@ | ||
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.dagPB`](https://github.com/ipld/js-ipld-dag-pb) | ||
- [`ipfs.types.dagCBOR`](https://github.com/ipld/js-ipld-dag-cbor) |
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,7 @@ | ||
UTIL API | ||
======= | ||
|
||
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: | ||
|
||
- [`ipfs.util.crypto`](https://github.com/libp2p/js-libp2p-crypto) | ||
- [`ipfs.util.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,53 @@ | ||
/* 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) | ||
|
||
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, | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-env mocha */ | ||
'use strict' | ||
|
||
const crypto = require('libp2p-crypto') | ||
const isIPFS = require('is-ipfs') | ||
|
||
const chai = require('chai') | ||
const dirtyChai = require('dirty-chai') | ||
const expect = chai.expect | ||
chai.use(dirtyChai) | ||
util | ||
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('util object', () => { | ||
expect(ipfs.util).to.be.deep.equal({ | ||
crypto: crypto, | ||
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