/** * Markers, type tables and the value classes of BJData Draft 4/5 * (https://neurojson.org/bjdata/draft4, https://github.com/NeuroJSON/bjdata). * * Copyright (c) 2019-2026 Qianqian Fang . Apache License 2.0. */ /** Size in bytes of each fixed-length marker. */ export declare const FIXED_SIZE: { [marker: string]: number; }; /** The integer markers (lengths, counts, dimensions, keys). */ export declare const INT_MARKERS = "iUIulmLM"; /** The JData _ArrayType_ name of each fixed-length marker. */ export declare const JDATA_TYPE: { [marker: string]: string; }; /** The marker of each JData _ArrayType_ name (with the spec's aliases). */ export declare const MARKER_OF_TYPE: { [name: string]: string; }; export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array; /** The typed-array constructor that holds each marker's values (half precision: Float32Array). */ export declare function typedArrayOf(marker: string): any; /** The marker of a typed array (by its constructor name, so that arrays of other realms count). */ export declare function markerOfTypedArray(a: any): string | null; export declare function isTypedArray(a: any): a is TypedArray; /** True on little-endian machines (all common ones): typed-array payloads are then copied as is. */ export declare const HOST_LITTLE: boolean; /** * A high-precision number ([H] marker): a JSON number in text, of any length and precision. The * bytes are kept as read, so that a JData _ByteStream_, also stored with [H], is not altered. */ export declare class HighPrec { readonly bytes: Uint8Array; constructor(value: string | Uint8Array); toString(): string; valueOf(): number; toJSON(): string; } /** * An extension value ([E][type-id][byte-length][payload]). Type ids 0-255 are reserved by the * specification (1 epoch_s ... 10 uuid); `value` gives the payload of a known type in a native * form (Date, {re, im}, a UUID string, ...), and the object is written back unchanged. */ export declare class Extension { readonly type: number; readonly data: Uint8Array; constructor(type: number, data: Uint8Array); /** The payload of a reserved type as a JavaScript value; the raw bytes for any other type. */ get value(): any; toJSON(): any; /** An extension for a Date: datetime_us (type 6), or epoch_s (type 1). */ static fromDate(date: Date, type?: number): Extension; /** A uuid extension (type 10) from its text form. */ static fromUUID(uuid: string): Extension; } /** A parse or encode error; `position` is the byte offset where decoding failed. */ export declare class BJDataError extends Error { readonly position?: number; constructor(message: string, position?: number); } /** A 64-bit integer: a number when it is exactly representable, else a BigInt (or, without * BigInt, the nearest number). `big` forces a BigInt. */ export declare function read64(v: DataView, at: number, signed: boolean, little: boolean, big?: boolean): number | bigint; export declare function write64(v: DataView, at: number, x: number | bigint, signed: boolean, little: boolean): void; export declare function halfToFloat(h: number): number; export declare function floatToHalf(x: number): number; /** The string of len (1 to 16) ASCII bytes at b[at] (the caller checks they are ASCII); the * fastest way in V8 for short strings: one flat string, no temporary array. */ export declare function shortAscii(b: Uint8Array, at: number, len: number): string; /** Whether the len bytes at b[at] are all ASCII. */ export declare function isAscii(b: Uint8Array, at: number, len: number): boolean; export declare function utf8Decode(b: Uint8Array, start: number, end: number): string; /** Writes the UTF-8 bytes of s into b at `at` (b has room for 3 * s.length bytes); returns the * number of bytes written. Lone surrogates become U+FFFD, as with TextEncoder. */ export declare function utf8Into(s: string, b: Uint8Array, at: number): number; export declare function utf8Encode(s: string): Uint8Array; /** A Uint8Array over any byte input: Uint8Array (Node Buffer), ArrayBuffer, DataView, a typed * array (its bytes), or an array of byte values. */ export declare function asBytes(input: any): Uint8Array;