MCPcopy
hub / github.com/codeaashu/claude-code / writeTextContent

Function writeTextContent

src/utils/file.ts:84–98  ·  view source on GitHub ↗
(
  filePath: string,
  content: string,
  encoding: BufferEncoding,
  endings: LineEndingType,
)

Source from the content-addressed store, hash-verified

82}
83
84export function writeTextContent(
85 filePath: string,
86 content: string,
87 encoding: BufferEncoding,
88 endings: LineEndingType,
89): void {
90 let toWrite = content
91 if (endings === 'CRLF') {
92 // Normalize any existing CRLF to LF first so a new_string that already
93 // contains \r\n (raw model output) doesn't become \r\r\n after the join.
94 toWrite = content.replaceAll('\r\n', '\n').split('\n').join('\r\n')
95 }
96
97 writeFileSyncAndFlush_DEPRECATED(filePath, toWrite, { encoding })
98}
99
100export function detectFileEncoding(filePath: string): BufferEncoding {
101 try {

Callers 4

callFunction · 0.85
callFunction · 0.85
callFunction · 0.85
applySedEditFunction · 0.85

Calls 1

Tested by

no test coverage detected