Skip to main content
Module

std/msgpack/mod.ts>encode

The Deno Standard Library
Go to Latest
function encode
import { encode } from "https://deno.land/std@0.223.0/msgpack/mod.ts";

Encode a value to MessagePack binary format.

Examples

Example 1

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

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

console.log(encode(obj))

Returns

Uint8Array