Skip to content

@msgpack/msgpack compatibliity #175

@jackyzha0

Description

@jackyzha0

hey there, thanks for your awesome work on this library!

we're interested in switching https://github.com/replit/river from using @msgpack/msgpack to using this package instead but found a few compatibility things with serializing some specific JS values (namely preserving Uint8Array)

{
  buff: Uint8Array.from([0, 42, 100, 255]),
}
 FAIL  codec/codec.test.ts > codec -- 'binary' > example -- 'buffer test' > encodes and decodes correctly
AssertionError: expected { buff: Buffer[ 0, 42, 100, 255 ] } to strictly equal { …(1) }

- Expected
+ Received

  {
-   "buff": Uint8Array [
+   "buff": {
+     "data": [
        0,
        42,
        100,
        255,
      ],
+     "type": "Buffer",
+   },
  }

with the test pretty much being packr.unpack(packr.pack(<payload>)) we were wondering if it was possible to add a compatibility flag to preserve Uint8Array?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions