Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/libp2p/js-peer-book
[DEPRECATED]: peer-book is now at https://github.com/libp2p/js-libp2p/tree/master/src/peer-store as PeerStore
https://github.com/libp2p/js-peer-book
Last synced: 9 days ago
JSON representation
[DEPRECATED]: peer-book is now at https://github.com/libp2p/js-libp2p/tree/master/src/peer-store as PeerStore
- Host: GitHub
- URL: https://github.com/libp2p/js-peer-book
- Owner: libp2p
- License: mit
- Archived: true
- Created: 2016-04-27T10:59:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-02-10T10:56:56.000Z (over 4 years ago)
- Last Synced: 2024-10-17T15:02:57.136Z (22 days ago)
- Language: JavaScript
- Homepage:
- Size: 1.32 MB
- Stars: 16
- Watchers: 21
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-peer-to-peer - peer-book
README
⛔️ DEPRECATED: peer-books is now included in [libp2p](https://github.com/libp2p/js-libp2p/tree/master/src/peer-store) and renamed into `peer-store`.
======# Peer Book JavaScript Implementation
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)
[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)
[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)
[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)
[![](https://img.shields.io/codecov/c/github/libp2p/js-peer-book.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-peer-book)
[![](https://img.shields.io/travis/libp2p/js-peer-book.svg?style=flat-square)](https://travis-ci.com/libp2p/js-peer-book)
[![Dependency Status](https://david-dm.org/libp2p/js-peer-book.svg?style=flat-square)](https://david-dm.org/libp2p/js-peer-book)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)> Peer Store for libp2p and IPFS
## Lead Maintainer
[Vasco Santos](https://github.com/vasco-santos)
## Table of Contents
soon™
## Installation
### npm
```sh
> npm i peer-book
```### Node.JS, Browserify, Webpack
```JavaScript
const PeerBook = require('peer-book')
```### Browser: `` Tag
Loading this module through a script tag will make the `PeerBook` obj available in the global namespace.
```html
<script src="https://unpkg.com/peer-book/dist/index.min.js">```
# Usage
### `put(peerInfo, replace)`
Adds the peerInfo using it's peerId to the peerBook
If the peerInfo for that id was already added, the addresses are going to be merged
If `replace` is set to true, then the peerInfo will be completly overwritten by the new one, without keeping the previous addresses.
### `get(peerIdLike)`
Gets the peerInfo using it's peerId
`peerIdLike` can be:
- A base58 peerId string
- Example: `QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM`
- A [Multiaddr](https://www.npmjs.com/package/multiaddr#api) string _with a peer-id_
- Example: `/ip4/127.0.0.1/tcp/1/ipfs/QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM`
- A peerId buffer
- Example: ``
- A [PeerId](https://www.npmjs.com/package/peer-id#api) object
- A [Multiaddr](https://www.npmjs.com/package/multiaddr#api) object _with a peer-id_
- A [PeerInfo](https://www.npmjs.com/package/peer-info#api) object# License
MIT