{"id":13482588,"url":"https://github.com/libp2p/js-peer-book","last_synced_at":"2025-03-27T13:32:12.424Z","repository":{"id":57099045,"uuid":"57206628","full_name":"libp2p/js-peer-book","owner":"libp2p","description":"[DEPRECATED]: peer-book is now at https://github.com/libp2p/js-libp2p/tree/master/src/peer-store as PeerStore","archived":true,"fork":false,"pushed_at":"2020-02-10T10:56:56.000Z","size":1379,"stargazers_count":16,"open_issues_count":2,"forks_count":16,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-03-14T16:02:15.943Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libp2p.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-27T10:59:38.000Z","updated_at":"2023-01-28T15:49:44.000Z","dependencies_parsed_at":"2022-08-20T17:30:39.522Z","dependency_job_id":null,"html_url":"https://github.com/libp2p/js-peer-book","commit_stats":null,"previous_names":["diasdavid/js-peer-book"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-peer-book","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-peer-book/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-peer-book/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fjs-peer-book/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libp2p","download_url":"https://codeload.github.com/libp2p/js-peer-book/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245779414,"owners_count":20670685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:03.548Z","updated_at":"2025-03-27T13:32:12.179Z","avatar_url":"https://github.com/libp2p.png","language":"JavaScript","funding_links":[],"categories":["Modules"],"sub_categories":[],"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`.\n======\n\n# Peer Book JavaScript Implementation\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)\n[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)\n[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)\n[![](https://img.shields.io/codecov/c/github/libp2p/js-peer-book.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-peer-book)\n[![](https://img.shields.io/travis/libp2p/js-peer-book.svg?style=flat-square)](https://travis-ci.com/libp2p/js-peer-book)\n[![Dependency Status](https://david-dm.org/libp2p/js-peer-book.svg?style=flat-square)](https://david-dm.org/libp2p/js-peer-book)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n\n\u003e Peer Store for libp2p and IPFS\n\n## Lead Maintainer\n\n[Vasco Santos](https://github.com/vasco-santos)\n\n## Table of Contents\n\nsoon™\n\n## Installation\n\n### npm\n\n```sh\n\u003e npm i peer-book\n```\n\n### Node.JS, Browserify, Webpack\n\n```JavaScript\nconst PeerBook = require('peer-book')\n```\n\n### Browser: `\u003cscript\u003e` Tag\n\nLoading this module through a script tag will make the `PeerBook` obj available in the global namespace.\n\n```html\n\u003cscript src=\"https://unpkg.com/peer-book/dist/index.min.js\"\u003e\u003c/script\u003e\n\u003c!-- OR --\u003e\n\u003cscript src=\"https://unpkg.com/peer-book/dist/index.js\"\u003e\u003c/script\u003e\n```\n\n# Usage\n\n### `put(peerInfo, replace)`\n\nAdds the peerInfo using it's peerId to the peerBook\n\nIf the peerInfo for that id was already added, the addresses are going to be merged\n\nIf `replace` is set to true, then the peerInfo will be completly overwritten by the new one, without keeping the previous addresses.\n\n### `get(peerIdLike)`\n\nGets the peerInfo using it's peerId\n\n`peerIdLike` can be:\n  - A base58 peerId string\n    - Example: `QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM`\n  - A [Multiaddr](https://www.npmjs.com/package/multiaddr#api) string _with a peer-id_\n    - Example: `/ip4/127.0.0.1/tcp/1/ipfs/QmfHZLGRxYoF87esc98DetgKwzMhE4gumCC9kq39EBrueM`\n  - A peerId buffer\n    - Example: `\u003cBuffer 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\u003e`\n  - A [PeerId](https://www.npmjs.com/package/peer-id#api) object\n  - A [Multiaddr](https://www.npmjs.com/package/multiaddr#api) object _with a peer-id_\n  - A [PeerInfo](https://www.npmjs.com/package/peer-info#api) object\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-peer-book","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibp2p%2Fjs-peer-book","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fjs-peer-book/lists"}