ファイルを読み込む
code: read01.ts
const result = await Deno.readFile(filename);
const dec = new TextDecoder("utf-8");
const text = dec.decode(result);
console.log(text);
または
code: read02.ts
const file = await Deno.open(filename);
const buf = new Buffer();
await Deno.copy(buf, file);
console.log(buf.toString());
どちらでもOK。
code:read03.ts
const content = await Deno.readTextFile(filename);
console.log(content);
code:read04.ts
const content = await readFileStr(filename);
console.log(content);