import { readFile } from "node:fs/promises";
import { client } from "./server";
export default async function readTextFile({ path }): Promise<string> {
if (client == null) throw Error("client must be defined");
const dbg = client.dbg("read-text-file");
dbg(`path="${path}"`);
if (typeof path != "string") {
throw Error(`provide the path as a string -- got path="${path}"`);
}
return (await readFile(path)).toString();
}