Skip to main content
Module

x/denops_std/function/nvim/mod.ts>msgpackdump

📚 Standard module for denops.vim
Go to Latest
function msgpackdump
import { msgpackdump } from "https://deno.land/x/denops_std@v6.4.0/function/nvim/mod.ts";

Convert a list of VimL objects to msgpack. Returned value is a readfile()-style list. When {type} contains "B", a Blob is returned instead. Example:

call writefile(msgpackdump([{}]), 'fname.mpack', 'b')

or, using a Blob:

call writefile(msgpackdump([{}], 'B'), 'fname.mpack')

This will write the single 0x80 byte to a fname.mpack file (dictionary with zero items is represented by 0x80 byte in messagepack).

Limitations:

  1. Funcrefs cannot be dumped.
  2. Containers that reference themselves cannot be dumped.
  3. Dictionary keys are always dumped as STR strings.
  4. Other strings and Blobs are always dumped as BIN strings.
  5. Points 3. and 4. do not apply to msgpack-special-dicts.

Parameters

denops: Denops
list: unknown
optional
type: unknown

Returns

Promise<unknown[] | unknown>