Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/msgpack/encode.ts>encode

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function encode
import { encode } from "https://deno.land/std@0.206.0/msgpack/encode.ts";

Encode a value to MessagePack binary format.

Examples

Example 1

import { encode } from "https://deno.land/std@0.206.0/msgpack/encode.ts";

const obj = {
  str: "deno",
  arr: [1, 2, 3],
  map: {
    foo: "bar"
  }
}

console.log(encode(obj))