Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

fix(docs): update to new get function #46

Merged
merged 3 commits into from
Sep 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,25 @@ Loading this module through a script tag will make the `PeerBook` obj available

# Usage

### `put`
### `put(peerInfo, replace)`

### `get`
Adds the peerInfo using it's peerId to the peerBook

### `getByB58String`
If the peerInfo for that id was already added, the addresses are going to be merged

### `getByMultihash`
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 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](https://www.npmjs.com/package/peer-id#api) object
- A [PeerInfo](https://www.npmjs.com/package/peer-info#api) object

# License

Expand Down