This package has been deprecated

Author message:

peer-books is now included in libp2p and renamed into peer-store

peer-book

0.9.2 • Public • Published

Peer Book JavaScript Implementation

Discourse posts Dependency Status js-standard-style

Peer Store for libp2p and IPFS

Lead Maintainer

Vasco Santos

Table of Contents

soon™

Installation

npm

> npm i peer-book

Node.JS, Browserify, Webpack

const PeerBook = require('peer-book')

Browser: <script> Tag

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>

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 string with a peer-id
    • Example: /ip4/127.0.0.1/tcp/1/ipfs/QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM
  • 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>
  • A PeerId object
  • A Multiaddr object with a peer-id
  • A PeerInfo object

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Published

Version History

  • Version
    Downloads (Last 7 Days)
    • Published

Package Sidebar

Install

npm i peer-book

Weekly Downloads

767

Version

0.9.2

License

MIT

Unpacked Size

6.12 MB

Total Files

10

Last publish

Collaborators

  • jacobheun
  • daviddias
  • achingbrain
  • pgte
  • vascosantos