MCPcopy Index your code
hub / github.com/nodejs/node / writeFileSync

Method writeFileSync

lib/internal/vfs/provider.js:300–311  ·  view source on GitHub ↗

* Writes a file synchronously. * @param {string} path The file path * @param {Buffer|string} data The data to write * @param {object} [options] Options

(path, data, options)

Source from the content-addressed store, hash-verified

298 * @param {object} [options] Options
299 */
300 writeFileSync(path, data, options) {
301 if (this.readonly) {
302 throw createEROFS('open', path);
303 }
304 const flag = options?.flag ?? 'w';
305 const handle = this.openSync(path, flag, options?.mode);
306 try {
307 handle.writeFileSync(data, options);
308 } finally {
309 handle.closeSync();
310 }
311 }
312
313 /**
314 * Appends to a file.

Callers 15

copyFileSyncMethod · 0.95
lint-md.mjsFile · 0.45
defineDefaultCommandsFunction · 0.45
writeFileSyncFunction · 0.45
appendFileSyncFunction · 0.45
saveMethod · 0.45
createVfsHandlersFunction · 0.45
appendFileSyncMethod · 0.45
mainFunction · 0.45

Calls 3

openSyncMethod · 0.95
createEROFSFunction · 0.85
closeSyncMethod · 0.45

Tested by 1

testFunction · 0.36