cesr
Version:
[](https://www.npmjs.com/package/cesr) [](https://github.com/lenkan/cesr-js/blob/main/LICENSE)
33 lines (32 loc) • 919 B
TypeScript
export interface CesrFrame {
type: "cesr";
code: string;
text: string;
}
export interface MessageFrame {
type: "message";
/**
* The serialization kind
*/
code: string;
text: string;
}
export type Frame = CesrFrame | MessageFrame;
export interface ParserOptions {
version?: number;
}
/**
* Parses CESR frames from an incoming stream of bytes.
*
* @param input Incoming stream of bytes
* @returns An iterable of CESR frames
*/
export declare function parseSync(input: Uint8Array | string, options?: ParserOptions): IterableIterator<Frame>;
/**
* Parses CESR frames from an incoming stream of bytes.
*
* @param input Incoming stream of bytes
* @returns An async iterable of CESR frames
*/
export declare function parse(input: ParserInput, options?: ParserOptions): AsyncIterableIterator<Frame>;
export type ParserInput = Uint8Array | string | AsyncIterable<Uint8Array>;