17 lines
451 B
JavaScript
17 lines
451 B
JavaScript
|
import { IFIO } from '../common/types.ts';
|
||
|
|
||
|
const DenoFileIO: IFIO = {
|
||
|
openFile: async function (path: string): Promise<string> {
|
||
|
const decoder = new TextDecoder('utf-8');
|
||
|
const data = await Deno.readFile(path);
|
||
|
return decoder.decode(data);
|
||
|
},
|
||
|
openFileSync: function (path: string): string {
|
||
|
const decoder = new TextDecoder('utf-8');
|
||
|
const data = Deno.readFileSync(path);
|
||
|
return decoder.decode(data);
|
||
|
},
|
||
|
};
|
||
|
|
||
|
export default DenoFileIO;
|