UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

26 lines (25 loc) • 1.26 kB
/** * Buffer → string decoding with encoding detection (#362). * * Order of resolution: * 1. Explicit override (any iconv-lite label). * 2. Deterministic BOM sniff (UTF-8 / UTF-16 LE / UTF-16 BE). * 3. `chardet` statistical detection, mapped to an iconv-lite label. * 4. Fallback to UTF-8 (preserves the historical hard-coded default). * * Decoding always goes through `iconv-lite`, and any residual BOM is stripped * from the decoded string so it can't glue onto the first token. */ import type { DecodedBuffer } from "../types/index.js"; /** Strip a leading BOM (U+FEFF) from an already-decoded string. */ export declare function stripBomString(text: string): string; /** * Decode a buffer to text, detecting the encoding unless overridden. * * @param isCompleteBuffer - Whether `buffer` is the entire source (default * `true`). Pass `false` when `buffer` is only a peeked prefix (e.g. a * streaming head-sniff) — the ASCII fast path still commits to "utf-8" for * the peeked bytes (unchanged behavior), but reports a lower confidence * since later bytes not yet seen could still be non-ASCII (#1199). */ export declare function decodeBuffer(buffer: Buffer, override?: string, isCompleteBuffer?: boolean): DecodedBuffer;