MCPcopy Index your code
hub / github.com/Waishnav/devspace / writeTextFile

Function writeTextFile

src/apply-patch.ts:388–398  ·  view source on GitHub ↗
(destination: string, content: string, mode?: number)

Source from the content-addressed store, hash-verified

386}
387
388async function writeTextFile(destination: string, content: string, mode?: number): Promise<void> {
389 await mkdir(dirname(destination), { recursive: true });
390 const temporary = `${destination}.devspace-patch-${process.pid}-${randomUUID()}`;
391 try {
392 await writeFile(temporary, content, mode === undefined ? undefined : { mode });
393 await replaceFile(temporary, destination, await fileExists(destination));
394 } catch (error) {
395 await rm(temporary, { force: true });
396 throw error;
397 }
398}
399
400function fileLines(content: string): string[] {
401 if (content.length === 0) return [];

Callers 1

applyPatchFunction · 0.85

Calls 2

replaceFileFunction · 0.85
fileExistsFunction · 0.85

Tested by

no test coverage detected