mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-18 12:08:59 +08:00
Merge pull request #21236 from TimBeyer/fix-msgpack-lite-options
fix(msgpack-lite): fix msgpack-lite option parameters
This commit is contained in:
8
types/msgpack-lite/index.d.ts
vendored
8
types/msgpack-lite/index.d.ts
vendored
@@ -125,7 +125,7 @@ export interface CodecOptions {
|
||||
* @see https://github.com/kawanet/msgpack-lite#compatibility-mode
|
||||
* @default false
|
||||
*/
|
||||
raw?: boolean;
|
||||
useraw?: boolean;
|
||||
/**
|
||||
* It decodes msgpack's int64/uint64 formats with int64-buffer object.
|
||||
* int64-buffer is a cutom integer type with 64 bits of precision instead
|
||||
@@ -140,8 +140,14 @@ export interface CodecOptions {
|
||||
binarraybuffer?: boolean;
|
||||
/**
|
||||
* It returns Uint8Array object when encoding, instead of Buffer object.
|
||||
* @default false
|
||||
*/
|
||||
uint8array?: boolean;
|
||||
/**
|
||||
* It uses the global JavaScript Map type, if available, to unpack MessagePack map elements.
|
||||
* @default false
|
||||
*/
|
||||
usemap?: boolean;
|
||||
}
|
||||
|
||||
export interface EncoderOptions {
|
||||
|
||||
@@ -9,6 +9,18 @@ function encodingAndDecoding() {
|
||||
const data = msgpack.decode(buffer); // => {"foo": "bar"}
|
||||
}
|
||||
|
||||
function customCodec() {
|
||||
msgpack.createCodec({
|
||||
preset: true,
|
||||
safe: true,
|
||||
useraw: true,
|
||||
int64: true,
|
||||
binarraybuffer: true,
|
||||
uint8array: true,
|
||||
usemap: true
|
||||
});
|
||||
}
|
||||
|
||||
// https://github.com/kawanet/msgpack-lite#writing-to-messagepack-stream
|
||||
function writingToStream() {
|
||||
const fs = require("fs");
|
||||
|
||||
Reference in New Issue
Block a user