-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathmsgpack.d.ts
28 lines (26 loc) · 1.28 KB
/
msgpack.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Serializes a value to a MessagePack byte array.
* @param data The value to serialize. This can be a scalar, array or object, but not a function.
* @param options An object that defined additional options.
*/
export function serialize(
data: any,
options?: {
/** Indicates whether multiple values in data are concatenated to multiple MessagePack arrays. If undefined, the default is `false`. */
multiple?: boolean,
/** The value that is used to replace values of unsupported types, or a function that returns such a value, given the original value as parameter. */
invalidTypeReplacement?: ((value: any) => (boolean | number | string | [] | object | null)) | boolean | number | string | [] | object | null,
}): Uint8Array;
/**
* Deserializes a MessagePack byte array to a value.
* @param array The MessagePack byte array to deserialize.
* @param options An object that defined additional options.
*/
export function deserialize(
array: Uint8Array | ArrayBuffer | [],
options?: {
/** Indicates whether multiple concatenated MessagePack arrays are returned as an array. If undefined, the default is `false`. */
multiple?: boolean,
}): any;
export { serialize as encode };
export { deserialize as decode };