@appium/support
Version:
Support libs used across Appium packages
28 lines • 1.48 kB
TypeScript
import { Writable, type WritableOptions } from 'node:stream';
/** Class which stores the last bit of data streamed into it */
export declare class MJpegStream extends Writable {
readonly errorHandler: (err: Error) => void;
readonly url: string;
/** Number of JPEG frames received so far (reset on {@linkcode clear}). Use stream['updateCount'] in tests if needed. */
private updateCount;
/** Last received JPEG chunk (base64 via {@linkcode lastChunkBase64}); `null` when no data yet or after {@linkcode clear}/stop. Use stream['lastChunk'] in tests if needed. */
private lastChunk;
private registerStartSuccess;
private registerStartFailure;
private responseStream;
private consumer;
/**
* @param mJpegUrl - URL of MJPEG-over-HTTP stream
* @param errorHandler - additional function that will be called in the case of any errors
* @param options - Options to pass to the Writable constructor
*/
constructor(mJpegUrl: string, errorHandler?: (err: Error) => void, options?: WritableOptions);
get lastChunkBase64(): string | null;
lastChunkPNG(): Promise<Buffer | null>;
lastChunkPNGBase64(): Promise<string | null>;
clear(): void;
start(serverTimeout?: number): Promise<void>;
stop(): void;
write(data: Buffer | string | Uint8Array, encoding?: BufferEncoding | ((error: Error | null) => void), callback?: (error: Error | null) => void): boolean;
}
//# sourceMappingURL=mjpeg.d.ts.map