Gathering detailed insights and metrics for @libp2p/peer-collections
Gathering detailed insights and metrics for @libp2p/peer-collections
Gathering detailed insights and metrics for @libp2p/peer-collections
Gathering detailed insights and metrics for @libp2p/peer-collections
The JavaScript Implementation of libp2p networking stack.
npm install @libp2p/peer-collections
Typescript
Module System
Node Version
NPM Version
webtransport: v5.0.50
Updated on Jul 08, 2025
webrtc: v5.2.23
Updated on Jul 08, 2025
circuit-relay-v2: v3.2.23
Updated on Jul 08, 2025
mplex: v11.0.46
Updated on Jul 08, 2025
floodsub: v10.1.45
Updated on Jul 08, 2025
perf: v4.0.46
Updated on Jul 08, 2025
TypeScript (98.72%)
JavaScript (1.16%)
Go (0.07%)
Makefile (0.03%)
Dockerfile (0.01%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
2,456 Stars
6,790 Commits
487 Forks
68 Watchers
59 Branches
227 Contributors
Updated on Jul 13, 2025
Latest Version
6.0.34
Package Id
@libp2p/peer-collections@6.0.34
Unpacked Size
787.79 kB
Size
207.91 kB
File Count
50
NPM Version
10.9.2
Node Version
22.16.0
Published on
Jun 25, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
5
Stores values against a peer id
We can't use PeerIds as collection keys because collection keys are compared using same-value-zero equality, so this is just a group of collections that stringifies PeerIds before storing them.
PeerIds cache stringified versions of themselves so this should be a cheap operation.
Tracked versions are also available which report their current size to the libp2p Metrics collector.
1import { peerList } from '@libp2p/peer-collections' 2import { peerIdFromPrivateKey } from '@libp2p/peer-id' 3import { generateKeyPair } from '@libp2p/crypto/keys' 4 5const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 6 7const list = peerList() 8list.push(peerId)
1import { trackedPeerList } from '@libp2p/peer-collections' 2import { peerIdFromPrivateKey } from '@libp2p/peer-id' 3import { generateKeyPair } from '@libp2p/crypto/keys' 4import { createLibp2p } from 'libp2p' 5 6const libp2p = await createLibp2p() 7const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 8 9const list = trackedPeerList({ name: 'my_metric_name', metrics: libp2p.metrics }) 10list.push(peerId)
1import { peerMap } from '@libp2p/peer-collections' 2import { peerIdFromPrivateKey } from '@libp2p/peer-id' 3import { generateKeyPair } from '@libp2p/crypto/keys' 4 5const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 6 7const map = peerMap<string>() 8map.set(peerId, 'value')
1import { trackedPeerMap } from '@libp2p/peer-collections' 2import { createLibp2p } from 'libp2p' 3import { peerIdFromPrivateKey } from '@libp2p/peer-id' 4import { generateKeyPair } from '@libp2p/crypto/keys' 5 6const libp2p = await createLibp2p() 7const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 8 9const map = trackedPeerMap({ name: 'my_metric_name', metrics: libp2p.metrics }) 10map.set(peerId, 'value')
1import { peerSet } from '@libp2p/peer-collections' 2import { peerIdFromPrivateKey } from '@libp2p/peer-id' 3import { generateKeyPair } from '@libp2p/crypto/keys' 4 5const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 6 7const set = peerSet() 8set.add(peerId)
1import { trackedPeerSet } from '@libp2p/peer-collections' 2import { createLibp2p } from 'libp2p' 3import { peerIdFromPrivateKey } from '@libp2p/peer-id' 4import { generateKeyPair } from '@libp2p/crypto/keys' 5 6const libp2p = await createLibp2p() 7const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 8 9const set = trackedPeerSet({ name: 'my_metric_name', metrics: libp2p.metrics }) 10set.add(peerId)
1import { peerFilter } from '@libp2p/peer-collections' 2import { peerIdFromPrivateKey } from '@libp2p/peer-id' 3import { generateKeyPair } from '@libp2p/crypto/keys' 4 5const peerId = peerIdFromPrivateKey(await generateKeyPair('Ed25519')) 6 7const filter = peerFilter(1024) 8filter.has(peerId) // false 9filter.add(peerId) 10filter.has(peerId) // true
1$ npm i @libp2p/peer-collections
<script>
tagLoading this module through a script tag will make its exports available as Libp2pPeerCollections
in the global namespace.
1<script src="https://unpkg.com/@libp2p/peer-collections/dist/index.min.js"></script>
Licensed under either of
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
No vulnerabilities found.
Reason
30 commit(s) and 16 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
branch protection not enabled on development/release branches
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More