mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-04-28 14:59:31 +07:00
10 lines
242 B
TypeScript
10 lines
242 B
TypeScript
import fs from "node:fs";
|
|
import toml from "toml";
|
|
|
|
export const readTomlFile = <T = any>(path?: string | null) => {
|
|
if (!path || !fs.existsSync(path)) {
|
|
return undefined;
|
|
}
|
|
return toml.parse(fs.readFileSync(path, "utf8")) as T;
|
|
};
|