import { decode } from "https://deno.land/x/denops_std@v4.3.1/buffer/buffer.ts";
Decode raw binary content for string array for the bufnr
buffer
import { Denops } from "../mod.ts";
import * as fn from "../function/mod.ts";
import { decode, open, replace } from "../buffer/mod.ts";
export async function main(denops: Denops): Promise<void> {
await open(denops, "README.md");
const bufnr = (await fn.bufnr(denops)) as number;
const data = await Deno.readFile("README.md");
const { content } = await decode(denops, bufnr, data);
await replace(denops, bufnr, content);
}
It follows Vim's rule to find a corresponding fileformat
and fileencoding
to
decode the data
if the one is not given by options
.
Returns
Promise<DecodeResult>