opnet
Version:
The perfect library for building Bitcoin-based applications.
21 lines (20 loc) • 858 B
TypeScript
import { ThreaderOptions, WorkerScript } from './interfaces/IThread.js';
import { BaseThreader } from './SharedThreader.js';
export type JsonValue = string | number | boolean | null | JsonValue[] | {
[key: string]: JsonValue;
};
type JsonOp = 'parse' | 'stringify';
type JsonInput = string | JsonValue | ArrayBuffer;
type JsonOutput = string | JsonValue;
export declare class JsonThreader extends BaseThreader<JsonOp, JsonInput, JsonOutput> {
protected readonly workerScript: WorkerScript;
private readonly threadingThreshold;
constructor(options?: ThreaderOptions & {
threadingThreshold?: number;
});
parse<T = JsonValue>(json: string): Promise<T>;
parseBuffer<T = JsonValue>(buffer: ArrayBuffer): Promise<T>;
stringify(data: JsonValue): Promise<string>;
}
export declare const jsonThreader: JsonThreader;
export {};