/// export = PeerStreams; declare const PeerStreams_base: typeof import("events").EventEmitter; /** * @typedef {import('../stream-muxer/types').MuxedStream} MuxedStream * @typedef {import('peer-id')} PeerId * @typedef {import('it-pushable').Pushable} PushableStream */ /** * Thin wrapper around a peer's inbound / outbound pubsub streams */ declare class PeerStreams extends PeerStreams_base { /** * @param {object} properties - properties of the PeerStreams. * @param {PeerId} properties.id * @param {string} properties.protocol */ constructor({ id, protocol }: { id: PeerId; protocol: string; }); /** * @type {import('peer-id')} */ id: import('peer-id'); /** * Established protocol * * @type {string} */ protocol: string; /** * The raw outbound stream, as retrieved from conn.newStream * * @private * @type {null|MuxedStream} */ private _rawOutboundStream; /** * The raw inbound stream, as retrieved from the callback from libp2p.handle * * @private * @type {null|MuxedStream} */ private _rawInboundStream; /** * An AbortController for controlled shutdown of the inbound stream * * @private * @type {AbortController} */ private _inboundAbortController; /** * Write stream -- its preferable to use the write method * * @type {null|PushableStream} */ outboundStream: null | import("it-pushable").Pushable; /** * Read stream * * @type {null| AsyncIterable} */ inboundStream: null | AsyncIterable; /** * Do we have a connection to read from? * * @type {boolean} */ get isReadable(): boolean; /** * Do we have a connection to write on? * * @type {boolean} */ get isWritable(): boolean; /** * Send a message to this peer. * Throws if there is no `stream` to write to available. * * @param {Uint8Array} data * @returns {void} */ write(data: Uint8Array): void; /** * Attach a raw inbound stream and setup a read stream * * @param {MuxedStream} stream * @returns {AsyncIterable} */ attachInboundStream(stream: MuxedStream): AsyncIterable; /** * Attach a raw outbound stream and setup a write stream * * @param {MuxedStream} stream * @returns {Promise} */ attachOutboundStream(stream: MuxedStream): Promise; /** * Closes the open connection to peer * * @returns {void} */ close(): void; } declare namespace PeerStreams { export { MuxedStream, PeerId, PushableStream }; } type MuxedStream = import("../stream-muxer/types").MuxedStream; type PeerId = import("peer-id"); type PushableStream = import("it-pushable").Pushable; //# sourceMappingURL=peer-streams.d.ts.map