UNPKG

@msgpack/msgpack

Version:

MessagePack for JavaScript/ECMA-262

44 lines (43 loc) 1.64 kB
import { ExtensionCodecType } from "./ExtensionCodec"; import { ContextOf, SplitUndefined } from "./context"; export declare type DecodeOptions<ContextType = undefined> = Readonly<Partial<{ extensionCodec: ExtensionCodecType<ContextType>; /** * Maximum string length. * Default to 4_294_967_295 (UINT32_MAX). */ maxStrLength: number; /** * Maximum binary length. * Default to 4_294_967_295 (UINT32_MAX). */ maxBinLength: number; /** * Maximum array length. * Default to 4_294_967_295 (UINT32_MAX). */ maxArrayLength: number; /** * Maximum map length. * Default to 4_294_967_295 (UINT32_MAX). */ maxMapLength: number; /** * Maximum extension length. * Default to 4_294_967_295 (UINT32_MAX). */ maxExtLength: number; }>> & ContextOf<ContextType>; export declare const defaultDecodeOptions: DecodeOptions; /** * It decodes a single MessagePack object in a buffer. * * This is a synchronous decoding function. * See other variants for asynchronous decoding: {@link decodeAsync()}, {@link decodeStream()}, or {@link decodeArrayStream()}. */ export declare function decode<ContextType = undefined>(buffer: ArrayLike<number> | BufferSource, options?: DecodeOptions<SplitUndefined<ContextType>>): unknown; /** * It decodes multiple MessagePack objects in a buffer. * This is corresponding to {@link decodeMultiStream()}. */ export declare function decodeMulti<ContextType = undefined>(buffer: ArrayLike<number> | BufferSource, options?: DecodeOptions<SplitUndefined<ContextType>>): Generator<unknown, void, unknown>;