@ende/msgpack
ende add jsr:@ende/msgpackVersion 2026.10.15 on JSR.
This module provides functions to encode and decode MessagePack.
MessagePack is an efficient binary serialization format that is language agnostic. It is like JSON, but generally produces much smaller payloads. Learn more about MessagePack.
import { decode, encode } from "@ende/msgpack";
import { assertEquals } from "@ende/assert";
const obj = {
str: "deno",
arr: [1, 2, 3],
bool: true,
nil: null,
map: {
foo: "bar"
}
};
const encoded = encode(obj);
assertEquals(encoded.length, 42);
const decoded = decode(encoded);
assertEquals(decoded, obj);
MessagePack supports encoding and decoding the following types:
numberbigintstringbooleannullUint8Array- arrays of values of these types
- objects with string or number keys, and values of these types
Modules
Exports
decode— Decode a value from the MessagePack binary format.encode— Encode a value to MessagePack binary format.Uint8Array_— Proxy type of {@code Uint8Array<ArrayBuffer>} or {@code Uint8Array} in TypeScript 5.7 or below respectively.ValueMap— Value map that can be encoded to MessagePack.ValueType— Value types that can be encoded to MessagePack.