Skip to main content
Home

Built and signed on GitHub Actions

Works with
This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score100%
Downloads34/wk
Publisheda year ago (1.0.3)

Encoding and decoding for the msgpack format

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 "@std/msgpack";
import { assertEquals } from "@std/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:

  • number
  • bigint
  • string
  • boolean
  • null
  • Uint8Array
  • arrays of values of these types
  • objects with string or number keys, and values of these types
Built and signed on
GitHub Actions

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/msgpack

Import symbol

import * as msgpack from "@std/msgpack";
or

Import directly with a jsr specifier

import * as msgpack from "jsr:@std/msgpack";

Add Package

pnpm i jsr:@std/msgpack
or (using pnpm 10.8 or older)
pnpm dlx jsr add @std/msgpack

Import symbol

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

Add Package

yarn add jsr:@std/msgpack
or (using Yarn 4.8 or older)
yarn dlx jsr add @std/msgpack

Import symbol

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

Add Package

vlt install jsr:@std/msgpack

Import symbol

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

Add Package

npx jsr add @std/msgpack

Import symbol

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

Add Package

bunx jsr add @std/msgpack

Import symbol

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