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);