# js-peer-book
**Repository Path**: mirrors_libp2p/js-peer-book
## Basic Information
- **Project Name**: js-peer-book
- **Description**: [DEPRECATED]: peer-book is now at https://github.com/libp2p/js-libp2p/tree/master/src/peer-store as PeerStore
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-09
- **Last Updated**: 2026-03-21
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## 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
[](http://protocol.ai)
[](http://libp2p.io/)
[](http://webchat.freenode.net/?channels=%23libp2p)
[](https://discuss.libp2p.io)
[](https://codecov.io/gh/libp2p/js-peer-book)
[](https://travis-ci.com/libp2p/js-peer-book)
[](https://david-dm.org/libp2p/js-peer-book)
[](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: `
```
# 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