UNPKG

cesr

Version:

[![NPM Version](https://img.shields.io/npm/v/cesr.svg?style=flat)](https://www.npmjs.com/package/cesr) [![NPM License](https://img.shields.io/npm/l/cesr.svg?style=flat)](https://github.com/lenkan/cesr-js/blob/main/LICENSE)

33 lines (32 loc) 919 B
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>;