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) 937 B
import type { MessageVersion } from "./encoding.ts"; export type Frame = { type: "cesr"; code: string; text: string; count?: number; index?: number; ondex?: number; raw: Uint8Array; } | { type: "message"; version: MessageVersion; text: string; }; 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>;