From 24b97d52886fcb0918a9b3a93f3032e76101541d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 24 Nov 2022 01:46:34 -0500 Subject: [PATCH] *Add peerHasItem method --- src/index.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/index.ts b/src/index.ts index 44e3fd6..a3b65bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -89,6 +89,13 @@ export default class DHTCache extends EventEmitter { return items.sort(); } + public peerHasItem(peer: string | Buffer, item: string | Buffer): boolean { + peer = this._maybeHexify(peer); + item = this._maybeHexify(item); + + return this.graph.hasSuccessor(peer, item); + } + public addItem(item: string | Buffer) { item = this._maybeHexify(item); this._cache.add(item);