import { IFileIO } from '../common/runtime.ts'; const DenoFileIO: IFileIO = { openFile: async function (path: string): Promise { const decoder = new TextDecoder('utf-8'); const data = await Deno.readFile(path); return decoder.decode(data); }, appendFile: async function (path: string, contents: string): Promise { const file = await Deno.open(path, { write: true, append: true, create: true, }); const encoder = new TextEncoder(); const writer = file.writable.getWriter(); await writer.write(encoder.encode(contents)); file.close(); }, saveFile: async function (path: string, contents: string): Promise { return await Deno.writeTextFile(path, contents); }, }; export default DenoFileIO;