mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-01 14:52:25 +00:00
refactor: migrate src/cli/cmd/session.ts from Bun.file() to statSync (#14144)
This commit is contained in:
@@ -18,12 +18,13 @@ export namespace Filesystem {
|
||||
}
|
||||
}
|
||||
|
||||
export function stat(p: string): ReturnType<typeof statSync> | undefined {
|
||||
return statSync(p, { throwIfNoEntry: false }) ?? undefined
|
||||
}
|
||||
|
||||
export async function size(p: string): Promise<number> {
|
||||
try {
|
||||
return statSync(p).size
|
||||
} catch {
|
||||
return 0
|
||||
}
|
||||
const s = stat(p)?.size ?? 0
|
||||
return typeof s === "bigint" ? Number(s) : s
|
||||
}
|
||||
|
||||
export async function readText(p: string): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user