Git Product home page Git Product logo

js-peer-book's Introduction

⛔️ DEPRECATED: peer-books is now included in libp2p and renamed into peer-store.

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

js-peer-book's People

Contributors

daviddias avatar pgte avatar greenkeeperio-bot avatar vasco-santos avatar dignifiedquire avatar hugomrdias avatar mkg20001 avatar victorb avatar jacobheun avatar npmcdn-to-unpkg-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.