MCPcopy Create free account
hub / github.com/cloudflare/computer / removePath

Function removePath

packages/computer/src/git/worktree.ts:282–296  ·  view source on GitHub ↗
(fs: RemoveFsClient, abs: string)

Source from the content-addressed store, hash-verified

280}
281
282async function removePath(fs: RemoveFsClient, abs: string): Promise<void> {
283 if (typeof fs.promises.rm === "function") {
284 await fs.promises.rm(abs, { recursive: true, force: true });
285 return;
286 }
287 // Fallback for fs implementations without `rm`: try unlink,
288 // then a recursive rmdir.
289 try {
290 await fs.promises.unlink(abs);
291 } catch {
292 if (typeof fs.promises.rmdir === "function") {
293 await fs.promises.rmdir(abs, { recursive: true });
294 }
295 }
296}
297
298function ancestorDirs(path: string): string[] {
299 const out: string[] = [];

Callers 1

cleanWithFunction · 0.85

Calls 3

rmMethod · 0.65
unlinkMethod · 0.65
rmdirMethod · 0.65

Tested by

no test coverage detected