MCPcopy Index your code
hub / github.com/codeaashu/claude-code / writeFileSync_DEPRECATED

Function writeFileSync_DEPRECATED

src/utils/slowOperations.ts:248–286  ·  view source on GitHub ↗
(
  filePath: string,
  data: string | NodeJS.ArrayBufferView,
  options?: WriteFileOptionsWithFlush,
)

Source from the content-addressed store, hash-verified

246 * Sync file writes block the event loop and cause performance issues.
247 */
248export function writeFileSync_DEPRECATED(
249 filePath: string,
250 data: string | NodeJS.ArrayBufferView,
251 options?: WriteFileOptionsWithFlush,
252): void {
253 using _ = slowLogging`fs.writeFileSync(${filePath}, ${data})`
254
255 // Check if flush is requested (for object-style options)
256 const needsFlush =
257 options !== null &&
258 typeof options === 'object' &&
259 'flush' in options &&
260 options.flush === true
261
262 if (needsFlush) {
263 // Manual flush: open file, write, fsync, close
264 const encoding =
265 typeof options === 'object' && 'encoding' in options
266 ? options.encoding
267 : undefined
268 const mode =
269 typeof options === 'object' && 'mode' in options
270 ? options.mode
271 : undefined
272 let fd: number | undefined
273 try {
274 fd = openSync(filePath, 'w', mode)
275 fsWriteFileSync(fd, data, { encoding: encoding ?? undefined })
276 fsyncSync(fd)
277 } finally {
278 if (fd !== undefined) {
279 closeSync(fd)
280 }
281 }
282 } else {
283 // No flush needed, use standard writeFileSync
284 fsWriteFileSync(filePath, data, options as WriteFileOptions)
285 }
286}
287

Callers 14

loadSettingsFromFlagFunction · 0.85
showInvalidConfigDialogFunction · 0.85
handleFilenameSubmitFunction · 0.85
editPromptInEditorFunction · 0.85
profileReportFunction · 0.85
writeLockFileFunction · 0.85
updateFunction · 0.85
saveInstalledPluginsV2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected