mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-04-27 22:39:31 +07:00
15 lines
277 B
TypeScript
15 lines
277 B
TypeScript
import toml from "toml";
|
|
|
|
export const readTomlFile = async <T = any>(path?: string | null) => {
|
|
if (!path) {
|
|
return undefined;
|
|
}
|
|
|
|
const file = Bun.file(path);
|
|
if (!(await file.exists())) {
|
|
return undefined;
|
|
}
|
|
|
|
return toml.parse(await file.text()) as T;
|
|
};
|