You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.2 KiB
TypeScript

8 months ago
/// <reference types="node" />
import { Transform, TransformCallback, TransformOptions } from 'stream';
export interface SlipDecoderOptions extends TransformOptions {
/** Custom start byte */
START?: number;
/** Custom start escape byte */
ESC_START?: number;
/** custom escape byte */
ESC?: number;
/** custom end byte */
END?: number;
/** custom escape end byte */
ESC_END?: number;
/** custom escape escape byte */
ESC_ESC?: number;
}
/**
* A transform stream that decodes slip encoded data.
* @extends Transform
*
* Runs in O(n) time, stripping out slip encoding and emitting decoded data. Optionally custom slip escape and delimiters can be provided.
*/
export declare class SlipDecoder extends Transform {
opts: {
START: number | undefined;
ESC: number;
END: number;
ESC_START: number | undefined;
ESC_END: number;
ESC_ESC: number;
};
buffer: Buffer;
escape: boolean;
start: boolean;
constructor(options?: SlipDecoderOptions);
_transform(chunk: Buffer, encoding: BufferEncoding, cb: TransformCallback): void;
_flush(cb: TransformCallback): void;
}