⛔️ DEPRECATED: peer-books is now included in libp2p and renamed into peer-store
.
Peer Store for libp2p and IPFS
soon™
> npm i peer-book
const PeerBook = require('peer-book')
Loading this module through a script tag will make the PeerBook
obj available in the global namespace.
<script src="https://unpkg.com/peer-book/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/peer-book/dist/index.js"></script>
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.
Gets the peerInfo using it's peerId
peerIdLike
can be:
- A base58 peerId string
- Example:
QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM
- Example:
- A Multiaddr string with a peer-id
- Example:
/ip4/127.0.0.1/tcp/1/ipfs/QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM
- Example:
- A peerId buffer
- Example:
<Buffer 12 20 fb cb db 25 57 c9 4c 7d 73 c6 d9 bb 83 cc e6 4d 7a de 66 59 12 94 bc 8d f3 95 5d 10 e6 ee ce 2e>
- Example:
- A PeerId object
- A Multiaddr object with a peer-id
- A PeerInfo object
MIT