/** * jda (jsdata): JData annotations for JavaScript, in browsers and Node.js * (https://neurojson.org/jdata, https://github.com/NeuroJSON/jsdata) * * const jd = require('jda'); // or import jd from 'jda', or the jdata global * const text = jd.stringify({vol: new Float32Array(64)}, {compression: 'zlib'}); * const data = jd.parse(text); // NDArray, Map, ... again * * Copyright (c) 2019-2026 Qianqian Fang . BSD 3-clause license. */ /// import { decode, DecodeOptions, JDataDecoder } from './decode'; import { encode, EncodeOptions, JDataEncoder } from './encode'; import { registerCodec, codecNames, base64ToBytes, bytesToBase64, lz4Decode, lz4Encode, shuffle, unshuffle, Codec } from './codecs'; import { NDArray, SparseArray, nest } from './ndarray'; import * as zlibmt from './zlibmt'; import { ThreadOptions, adler32, closeWorkers } from './zlibmt'; export { decode, encode, DecodeOptions, EncodeOptions, JDataDecoder, JDataEncoder, registerCodec, codecNames, Codec, base64ToBytes, bytesToBase64, lz4Decode, lz4Encode, shuffle, unshuffle, NDArray, SparseArray, nest, ThreadOptions, zlibmt, adler32, closeWorkers }; export declare const version = "1.0.0"; /** Values of JSON text with JData annotations. */ export declare function parse(text: string, opts?: DecodeOptions): any; /** JSON text with JData annotations of a value. */ export declare function stringify(value: any, opts?: EncodeOptions, space?: string | number): string; /** Values of BJData bytes with JData annotations (needs bjd: installed, the bjdata global, or * the bjd option). */ export declare function loadbj(bytes: any, opts?: DecodeOptions & { bjd?: any; bjdOptions?: any; }): any; /** BJData bytes with JData annotations of a value (needs bjd). */ export declare function savebj(value: any, opts?: EncodeOptions & { bjd?: any; bjdOptions?: any; }): Uint8Array; /** decode(), with the zlib and gzip payloads inflated on threads. */ export declare function decodeAsync(value: any, opts?: DecodeOptions & ThreadOptions): Promise; /** encode(), with the zlib and gzip payloads deflated on threads (zlib in zlibmt blocks). */ export declare function encodeAsync(value: any, opts?: EncodeOptions & ThreadOptions): Promise; /** parse(), with the payloads inflated on threads. */ export declare function parseAsync(text: string, opts?: DecodeOptions & ThreadOptions): Promise; /** stringify(), with the payloads deflated on threads. */ export declare function stringifyAsync(value: any, opts?: EncodeOptions & ThreadOptions, space?: string | number): Promise; /** loadbj(), with the payloads inflated on threads. */ export declare function loadbjAsync(bytes: any, opts?: DecodeOptions & ThreadOptions & { bjd?: any; bjdOptions?: any; }): Promise; /** savebj(), with the payloads deflated on threads. */ export declare function savebjAsync(value: any, opts?: EncodeOptions & ThreadOptions & { bjd?: any; bjdOptions?: any; }): Promise; /** * The jda 0.x class: new jdata(data, options).encode().tojson(), new jdata(obj).decode().data; * options: {compression, base64, ...} as for encode() and decode(). */ export default class jdata { data: any; opt: any; base64: boolean; constructor(data?: any, options?: any); encode(): this; decode(): this; tojson(space?: string | number): string; zip(buf: any, method?: string): any; unzip(data: any, method?: string): Uint8Array; base64ToBytes(s: string): Uint8Array; bytesToBase64(b: Uint8Array): string; static decode: typeof decode; static encode: typeof encode; static parse: typeof parse; static stringify: typeof stringify; static loadbj: typeof loadbj; static savebj: typeof savebj; static decodeAsync: typeof decodeAsync; static encodeAsync: typeof encodeAsync; static parseAsync: typeof parseAsync; static stringifyAsync: typeof stringifyAsync; static loadbjAsync: typeof loadbjAsync; static savebjAsync: typeof savebjAsync; static zlibmt: typeof zlibmt; static adler32: typeof zlibmt.adler32; static closeWorkers: typeof zlibmt.closeWorkers; static registerCodec: typeof registerCodec; static codecNames: typeof codecNames; static NDArray: typeof NDArray; static SparseArray: typeof SparseArray; static base64ToBytes: typeof base64ToBytes; static bytesToBase64: typeof bytesToBase64; static version: string; }