@libp2p/mplex
Version:
JavaScript implementation of https://github.com/libp2p/mplex
34 lines • 1.22 kB
TypeScript
import { AbstractStream } from '@libp2p/utils';
import { Uint8ArrayList } from 'uint8arraylist';
import type { MplexStreamMuxer } from './mplex.ts';
import type { Logger, MessageStreamDirection } from '@libp2p/interface';
import type { AbstractStreamInit, SendResult } from '@libp2p/utils';
import type { AbortOptions } from 'it-pushable';
export interface Options {
id: number;
log: Logger;
direction: MessageStreamDirection;
maxMsgSize?: number;
muxer: MplexStreamMuxer;
}
interface MplexStreamInit extends AbstractStreamInit {
maxDataSize: number;
muxer: MplexStreamMuxer;
direction: MessageStreamDirection;
}
export declare class MplexStream extends AbstractStream {
readonly streamId: number;
private readonly types;
private readonly maxDataSize;
private readonly muxer;
constructor(init: MplexStreamInit);
sendData(data: Uint8ArrayList): SendResult;
sendReset(): boolean;
sendCloseWrite(options?: AbortOptions): Promise<void>;
sendCloseRead(options?: AbortOptions): Promise<void>;
sendPause(): void;
sendResume(): void;
}
export declare function createStream(options: Options): MplexStream;
export {};
//# sourceMappingURL=stream.d.ts.map