p2p-media-loader-core
Version:
P2P Media Loader core functionality
28 lines (27 loc) • 1.12 kB
TypeScript
import { PeerCommandType, PeerCommand } from "./types.js";
export declare function isCommandChunk(buffer: Uint8Array): boolean;
export declare class BinaryCommandJoiningError extends Error {
readonly type: "incomplete-joining" | "no-first-chunk";
constructor(type: "incomplete-joining" | "no-first-chunk");
}
export declare class BinaryCommandChunksJoiner {
private readonly onComplete;
private readonly chunks;
private status;
constructor(onComplete: (commandBuffer: Uint8Array) => void);
addCommandChunk(chunk: Uint8Array): void;
private unframeCommandChunk;
}
export declare class BinaryCommandCreator {
private readonly maxChunkLength;
private readonly bytes;
private resultBuffers;
private status;
constructor(commandType: PeerCommandType, maxChunkLength: number);
addInteger(name: string, value: number): void;
addSimilarIntArr(name: string, arr: number[]): void;
addString(name: string, string: string): void;
complete(): void;
getResultBuffers(): Uint8Array[];
}
export declare function deserializeCommand(bytes: Uint8Array): PeerCommand;