UNPKG

tedious

Version:

A TDS driver, for connecting to MS SQLServer databases.

25 lines (24 loc) • 1.05 kB
import Parser, { type ParserOptions } from './token/stream-parser'; import { type Metadata } from './metadata-parser'; import { Result } from './token/helpers'; declare function readValue(buf: Buffer, offset: number, metadata: Metadata, options: ParserOptions): Result<unknown>; declare function isPLPStream(metadata: Metadata): boolean | undefined; /** * Reads a PLP (partially length-prefixed) value. * * PLP values can be arbitrarily large and span many chunks of incoming data, * so they are read incrementally: whatever part of the value is available is * consumed right away, and the reader's progress is kept across calls. If the * available data runs out, `NotEnoughDataError` is thrown and `read` can be * called again once more data has arrived. */ declare class PLPReader { metadata: Metadata; expectedLength: bigint | undefined; chunks: Buffer[]; length: number; chunkRemaining: number; constructor(metadata: Metadata); read(parser: Parser): unknown; } export { readValue, isPLPStream, PLPReader };