3.3.7 • Published 19 days ago

@softvisio/msgpack v3.3.7

Weekly downloads
36
License
ISC
Repository
github
Last release
19 days ago

: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 i @softvisio/msgpack

Usage

import * as msgpack from "@softvisio/msgpack";

const buffer = msgpack.encode([new Date()]);

const data = msgpack.decode(buffer);

msgpack.encode( data )

  • data <any> Data structire to encode.
  • Returns: <Buffer> Encoded data.

msgpack.decode( buffer, stream? )

  • buffer <Buffer> | <ArrayBuffer> | <Uint8Array> Data to decode.
  • stream? <boolean> Stream mode flag.
  • Returns: <any> Decoded data. In the stream mode returns <Array>:
    • <any> Decoded data.
    • <integer> Decoded data buffer length.

Class: msgpack.decode.Stream

const stream = new msgpack.decode.Stream();

stream.on("data", msg => {});

socket.on("error", e => stream.destroy());

socket.pipe(stream);

new msgpack.decode.Stream()

  • Returns: <msgpack.decode.Stream> MessagePack stream decoder. Instance of the <stream.Transform>. Stream works in the object mode.

Custom extensions

Specification https://github.com/msgpack/msgpack/blob/master/spec.md.

TypeCodes
<undefined>0xd4 0x00
<ArrayBuffer>0xc7 0x00
0xc8 0x00
0xc9 0x09
<Date>0xc7 0xff
<BigInt>0xc7 0x01
0xc8 0x01
0xc9 0x01
3.3.7

19 days ago

3.3.6

3 months ago

3.3.5

3 months ago

3.3.1

8 months ago

3.2.13

10 months ago

3.3.0

9 months ago

3.2.12

10 months ago

3.2.15

9 months ago

3.2.14

9 months ago

3.3.4

7 months ago

3.3.3

8 months ago

3.3.2

8 months ago

3.2.11

11 months ago

3.2.10

1 year ago

3.2.9

1 year ago

3.2.8

1 year ago

3.2.7

2 years ago

3.2.6

2 years ago

3.2.5

2 years ago

3.2.4

2 years ago

3.2.3

2 years ago

3.2.2

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.6

3 years ago

3.1.5

3 years ago

3.1.4

3 years ago

3.1.3

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.0

3 years ago

3.0.0-alpha.0

3 years ago

2.0.0

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.4.5

3 years ago

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.2

3 years ago

0.3.3

3 years ago

0.3.0

3 years ago

0.3.1

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago