diff options
| author | Dax <[email protected]> | 2026-02-18 19:37:10 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-18 19:37:10 -0500 |
| commit | 3a07dd8d96e3e4cbc6787ae14add19b2d58023be (patch) | |
| tree | 1988d1bb9e3ffb3f956fef4b698414be4a586697 | |
| parent | 802ccd37888b355dcd779be48b4994efc92168fa (diff) | |
| download | opencode-3a07dd8d96e3e4cbc6787ae14add19b2d58023be.tar.gz opencode-3a07dd8d96e3e4cbc6787ae14add19b2d58023be.zip | |
refactor: migrate src/project/project.ts from Bun.file() to Filesystem/stat modules (#14126)
| -rw-r--r-- | packages/opencode/src/project/project.ts | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts index 8fa0f6c6f..63c1c4cad 100644 --- a/packages/opencode/src/project/project.ts +++ b/packages/opencode/src/project/project.ts @@ -86,8 +86,7 @@ export namespace Project { const gitBinary = Bun.which("git") // cached id calculation - let id = await Bun.file(path.join(dotgit, "opencode")) - .text() + let id = await Filesystem.readText(path.join(dotgit, "opencode")) .then((x) => x.trim()) .catch(() => undefined) @@ -125,9 +124,7 @@ export namespace Project { id = roots[0] if (id) { - void Bun.file(path.join(dotgit, "opencode")) - .write(id) - .catch(() => undefined) + void Filesystem.write(path.join(dotgit, "opencode"), id).catch(() => undefined) } } @@ -277,10 +274,9 @@ export namespace Project { ) const shortest = matches.sort((a, b) => a.length - b.length)[0] if (!shortest) return - const file = Bun.file(shortest) - const buffer = await file.arrayBuffer() - const base64 = Buffer.from(buffer).toString("base64") - const mime = file.type || "image/png" + const buffer = await Filesystem.readBytes(shortest) + const base64 = buffer.toString("base64") + const mime = Filesystem.mimeType(shortest) || "image/png" const url = `data:${mime};base64,${base64}` await update({ projectID: input.id, @@ -381,10 +377,8 @@ export namespace Project { const data = fromRow(row) const valid: string[] = [] for (const dir of data.sandboxes) { - const stat = await Bun.file(dir) - .stat() - .catch(() => undefined) - if (stat?.isDirectory()) valid.push(dir) + const s = Filesystem.stat(dir) + if (s?.isDirectory()) valid.push(dir) } return valid } |
