@softvisio/msgpack v3.4.7
:information_source: Please, see the full project documentation here:https://softvisio-node.github.io/msgpack/
Introduction
Fork of the notepack.io with improvements:
- Code optimizations.
- Streaming decoder.
- {Date} encoded with the standard msgpack protocol extension (breaking change).
- {BigInt} type support.
Install
npm install @softvisio/msgpackUsage
import * as msgpack from "@softvisio/msgpack";
const buffer = msgpack.encode( [ new Date() ] );
const data = msgpack.decode( buffer );msgpack.encode( data, encoding? )
data{any} Data structire to encode.encoding?{string} Return string in the specified encoding.- Returns: {Buffer|string} Encoded data. Returns {string} if
encodingparameter is provided.
msgpack.decode( data, encoding? )
data{Buffer|ArrayBuffer|Uint8Array|string} Data to decode.encoding?{string} String encoding ifdataparameter is {string}.- Returns: {any} Decoded data.
Throws error if unable to decode message.
msgpack.decodeStream( data, offset )
data{Buffer|ArrayBuffer|Uint8Array|string} Data to decode.offset?{integer} Offset of the message start in the passed data. Default:0.- Returns: {Object}:
value{any} Decoded data.offset{integer} Offset of the decoded message end in the passed data.
Returns {undefined} if message is incomplete.
Throws error if unable to decode message.
Custom extensions
Specification https://github.com/msgpack/msgpack/blob/master/spec.md.
| Type | Codes |
|---|---|
| {undefined} | 0xd4 0x00 |
| {ArrayBuffer} | 0xc7 0x00 |
0xc8 0x00 | |
0xc9 0x09 | |
| {Date} | 0xc7 0xff |
| {BigInt} | 0xc7 0x01 |
0xc8 0x01 | |
0xc9 0x01 |
10 months ago
8 months ago
8 months ago
8 months ago
10 months ago
5 months ago
5 months ago
7 months ago
11 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago