UNPKG

@jsonjoy.com/json-pack

Version:

High-performance JSON serialization library

50 lines (49 loc) 1.68 kB
import type { IReader, IReaderResettable } from '@jsonjoy.com/buffers/lib'; import type { BinaryJsonDecoder, PackValue } from '../types'; export declare class RespDecoder<R extends IReader & IReaderResettable = IReader & IReaderResettable> implements BinaryJsonDecoder { reader: R; /** * When set to true, the decoder will attempt to decode RESP Bulk strings * (which are binary strings, i.e. Uint8Array) as UTF-8 strings. If the * string is not valid UTF-8, it will be returned as a Uint8Array. * * You can toggle this setting at any time, before each call to `decode()` * or `read()`, or other methods. */ tryUtf8: boolean; constructor(reader?: R); read(uint8: Uint8Array): PackValue; /** @deprecated */ decode(uint8: Uint8Array): unknown; val(): unknown; readAny(): unknown; protected readLength(): number; readCmd(): [cmd: string, ...args: Uint8Array[]]; readBool(): boolean; readInt(): number; readFloat(): number; readBigint(): bigint; readStrSimple(): string; readStrBulk(): Uint8Array | string | null; readAsciiAsStrBulk(): string; readStrVerbatim(): string | Uint8Array; readErrSimple(): Error; readErrBulk(): Error; readArr(): unknown[] | null; readSet(): Set<unknown>; readObj(): Record<string, unknown>; skipN(n: number): void; skipAny(): void; skipBool(): void; skipInt(): void; skipFloat(): void; skipBigint(): void; skipStrSimple(): void; skipStrBulk(): void; skipStrVerbatim(): void; skipErrSimple(): void; skipErrBulk(): void; skipArr(): void; skipSet(): void; skipObj(): void; }