Files
diachron/express/util.ts

17 lines
341 B
TypeScript

import { readFile } from "node:fs/promises";
import nunjucks from "nunjucks";
// FIXME: Handle the error here
const loadFile = async (path: string): Promise<string> => {
// Specifying 'utf8' returns a string; otherwise, it returns a Buffer
const data = await readFile(path, "utf8");
return data;
};
export {
loadFile,
}