mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 07:13:58 +00:00
26 lines
664 B
TypeScript
26 lines
664 B
TypeScript
export const LOG_PREFIX = "openclaw";
|
|
export const LOG_SUFFIX = ".log";
|
|
|
|
export function canUseNodeFs(): boolean {
|
|
const getBuiltinModule = (
|
|
process as NodeJS.Process & {
|
|
getBuiltinModule?: (id: string) => unknown;
|
|
}
|
|
).getBuiltinModule;
|
|
if (typeof getBuiltinModule !== "function") {
|
|
return false;
|
|
}
|
|
try {
|
|
return getBuiltinModule("fs") !== undefined;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function formatLocalDate(date: Date): string {
|
|
const year = date.getFullYear();
|
|
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
const day = String(date.getDate()).padStart(2, "0");
|
|
return `${year}-${month}-${day}`;
|
|
}
|