/** * BJData decoder (Draft 4, and the Draft 5 structure-of-arrays containers and extensions). * * Copyright (c) 2019-2026 Qianqian Fang . Apache License 2.0. */ export interface DecodeOptions { /** 64-bit integer scalars ([L], [M]): 'auto' (default) a number when exact, else a BigInt; * 'always' a BigInt; 'never' a number (rounded beyond 2^53) */ bigint?: 'auto' | 'always' | 'never'; /** N-D packed arrays ([$type#[dims]): 'jdata' (default) an {_ArrayType_, _ArraySize_, * _ArrayData_: TypedArray} object; 'nested' nested arrays; 'flat' the typed array alone; or * a function (data, shape, order 'C'|'F', type) => value */ ndarray?: 'jdata' | 'nested' | 'flat' | ((data: any, shape: number[], order: 'C' | 'F', type: string) => any); /** Structure-of-arrays containers: 'records' (default) an array of objects; 'columns' an * object of columns (typed arrays for numeric fields) */ soa?: 'records' | 'columns'; /** [H] values: 'object' (default) a HighPrec, 'string', or 'number' */ highprec?: 'object' | 'string' | 'number'; /** [E] values: a function (type, payload) => value; default an Extension object */ extension?: (type: number, data: Uint8Array) => any; /** copy typed payloads out of the input (default true); false returns views into the input * where the alignment allows */ copy?: boolean; /** byte order of the numbers: 'little' (BJData, default) or 'big' (UBJSON, BJData Draft 1) */ endian?: 'little' | 'big'; /** maximum container nesting (default 1000) */ maxDepth?: number; } export declare class Decoder { private b; private v; private n; pos: number; private little; private o; private depth; private maxDepth; private keys; constructor(input: any, opts?: DecodeOptions); get length(): number; private bad; private need; private next; private peek; /** Skips no-op markers; false at the end of the input (between top-level values). */ skipNoop(): boolean; private num; /** A non-negative integer (a length, count or dimension), as a number. */ private uint; private text; /** A length: the common [U] inline, any integer type else. */ private len; private bytes; /** The value starting at the current position (no-op markers are not values). */ value(): any; private key; /** A short string (1 to 32 bytes): when ASCII and seen before, the same string again. */ private cachedText; /** The byte at the current position (end of data is an error). */ private at; private container; /** After '#': a count, or (allowDims) an N-D dimension array, row-major [d1 d2 ...] or * column-major [[d1 d2 ...]]. */ private countOrDims; /** A dimension array after its '[': [$t#n raw], [#n m v ...] or [m v ... ]. */ private dimBody; private uintRaw; /** A typed array payload of count elements of type t. */ private typed; private packed; private typedObject; private offsets; /** A schema whose '{' has been read. */ private schema; private fields; private typeSpec; private highprec; private soa; } /** Sets a member, also one named __proto__ (as JSON.parse does), without touching the prototype. */ export declare function setKey(o: any, k: string, v: any): void; /** Nested arrays of the shape dims from flat data in row-major ('C') or column-major ('F') order. */ export declare function nest(data: ArrayLike, dims: number[], order?: 'C' | 'F'): any; /** The first top-level value of the input (no-op markers before it are skipped). */ export declare function loadb(input: any, opts?: DecodeOptions): any; /** Every top-level value of the input, in order (a JSON-Mmap file: [table, document]). */ export declare function loadbAll(input: any, opts?: DecodeOptions): any[]; /** The value at a byte offset and the offset after it: [value, nextOffset]. */ export declare function decodeAt(input: any, offset?: number, opts?: DecodeOptions): [any, number];