Merge pull request #8 from burke/native-realpath

Use native realpathSync instead of spawning subprocess per file
(15.6s -> 1.0s for large collections)
This commit is contained in:
Tobi Lutke 2026-01-09 17:33:12 -05:00
commit 5b636b2e4c
No known key found for this signature in database

View File

@ -13,6 +13,7 @@
import { Database } from "bun:sqlite";
import { Glob } from "bun";
import { realpathSync } from "node:fs";
import * as sqliteVec from "sqlite-vec";
import {
LlamaCpp,
@ -116,12 +117,10 @@ export function getPwd(): string {
export function getRealPath(path: string): string {
try {
const result = Bun.spawnSync(["realpath", path]);
if (result.success) {
return result.stdout.toString().trim();
}
} catch { }
return resolve(path);
return realpathSync(path);
} catch {
return resolve(path);
}
}
// =============================================================================