webserial-core
Version:
A strongly-typed, event-driven, abstract TypeScript library for the Web Serial API with custom parsers, command queue, handshake validation, and auto-reconnect.
23 lines (22 loc) • 681 B
TypeScript
import { SerialParser } from '../types/index.js';
/**
* Creates a raw pass-through parser that emits each incoming byte chunk
* directly without any buffering or splitting.
*
* Use this when you want to handle framing yourself, or when the device
* sends infrequent, self-contained binary packets.
*
* @returns A {@link SerialParser} that emits raw `Uint8Array` chunks.
*
* @example
* ```ts
* import { AbstractSerialDevice, raw } from 'webserial-core';
*
* class RawDevice extends AbstractSerialDevice<Uint8Array> {
* constructor() {
* super({ baudRate: 115200, parser: raw() });
* }
* }
* ```
*/
export declare function raw(): SerialParser<Uint8Array>;