UNPKG

ipfs-bitswap

Version:

JavaScript implementation of the Bitswap data exchange protocol used by IPFS

30 lines 1.15 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import { type ProgressOptions } from 'progress-events'; import type { BitswapWantBlockProgressEvents } from './index.js'; import type { AbortOptions, PeerId } from '@libp2p/interface'; import type { CID } from 'multiformats/cid'; export declare class Notifications extends EventEmitter { private readonly _log; /** * Internal module used to track events about incoming blocks, * wants and unwants. */ constructor(peerId: PeerId); /** * Signal the system that we received `block`. */ hasBlock(cid: CID, block: Uint8Array): void; /** * Signal the system that we are waiting to receive the * block associated with the given `cid`. * Returns a Promise that resolves to the block when it is received, * or undefined when the block is unwanted. */ wantBlock(cid: CID, options?: AbortOptions & ProgressOptions<BitswapWantBlockProgressEvents>): Promise<Uint8Array>; /** * Signal that the block is not wanted anymore */ unwantBlock(cid: CID): void; } //# sourceMappingURL=notifications.d.ts.map