You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

peer-info

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.3 to 0.4.0

.zuul.yml

31

package.json
{
"name": "peer-info",
"version": "0.3.3",
"description": "IPFS Peer abstraction Node.js implementation",
"version": "0.4.0",
"description": "IPFS Peer abstraction JavaScript implementation",
"main": "src/index.js",
"scripts": {
"test": "./node_modules/.bin/lab tests/*-test.js",
"coverage": "./node_modules/.bin/lab -t 100 tests/*-test.js",
"codestyle": "./node_modules/.bin/standard --format",
"lint": "jshint .",
"validate": "npm ls"
"test:node": "node tests/*-test.js",
"lint": "standard",
"test": "npm run test:node",
"test:browser": "./node_modules/.bin/zuul --browser-version $BROWSER_VERSION --browser-name $BROWSER_NAME -- tests/peer-test.js",
"test:browser:q": "BROWSER_VERSION=46 BROWSER_NAME=chrome npm run test:browser",
"build": "./node_modules/.bin/browserify -s PeerInfo -e ./src/index.js | tee dist/peer-info.js | ./node_modules/.bin/uglifyjs -m > dist/peer-info.min.js"
},

@@ -21,3 +22,3 @@ "repository": {

"engines": {
"node": "^4.0.0"
"node": "^4.2.0"
},

@@ -31,14 +32,14 @@ "author": "David Dias <daviddias@ipfs.io>",

"pre-commit": [
"codestyle",
"lint",
"test"
],
"devDependencies": {
"code": "^1.4.1",
"lab": "^5.13.0",
"multiaddr": "^1.1.1",
"peer-id": "^0.4.0",
"pre-commit": "^1.1.1",
"standard": "^4.5.2"
"standard": "^4.5.2",
"tape": "^4.2.2",
"zuul": "^3.7.2"
},
"dependencies": {
"peer-id": "^0.3.0"
}
"dependencies": {}
}

@@ -6,3 +6,2 @@ peer-info JavaScript implementation

> IPFS Peer abstraction JavaScript implementation

@@ -13,1 +12,28 @@

# Usage
### In Node.js through npm
```bash
$ npm install --save peer-info
```
```javascript
var PeerInfo = require('peer-info')
```
### In the Browser through browserify
Same as in Node.js, you just have to [browserify](https://github.com/substack/node-browserify) the code before serving it. See the browserify repo for how to do that.
### In the Browser through `<script>` tag
Make the [peer-info.min.js](/dist/peer-info.min.js) available through your server and load it using a normal `<script>` tag, this will export the `peerId` constructor on the `window` object, such that:
```JavaScript
var PeerInfo = window.PeerInfo
```
#### Gotchas
You will need to use Node.js `Buffer` API compatible, if you are running inside the browser, you can access it by `PeerInfo.Buffer` or you can install Feross's [Buffer](https://github.com/feross/buffer).

@@ -5,4 +5,2 @@ /*

var PeerId = require('peer-id')
exports = module.exports = Peer

@@ -17,4 +15,4 @@

if (!(id instanceof PeerId)) {
throw new Error('Peer must be created with an instance of PeerId')
if (!Array.isArray(multiaddrs)) {
multiaddrs = [multiaddrs]
}

@@ -21,0 +19,0 @@

@@ -0,1 +1,12 @@

var test = require('tape')
var PeerId = require('peer-id')
var Multiaddr = require('multiaddr')
var PeerInfo = require('../src')
test('test creation', function (t) {
var id = PeerId.create()
var mh = Multiaddr('/ip4/127.0.0.1/tcp/5001')
var pi = new PeerInfo(id, mh)
t.ok(pi)
t.end()
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc