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

Function renameSync

lib/fs.js:1242–1252  ·  view source on GitHub ↗

* Synchronously renames file at `oldPath` to * the pathname provided as `newPath`. * @param {string | Buffer | URL} oldPath * @param {string | Buffer | URL} newPath * @returns {void}

(oldPath, newPath)

Source from the content-addressed store, hash-verified

1240 * @returns {void}
1241 */
1242function renameSync(oldPath, newPath) {
1243 const h = vfsState.handlers;
1244 if (h !== null) {
1245 const result = h.renameSync(oldPath, newPath);
1246 if (result !== undefined) return;
1247 }
1248 binding.rename(
1249 getValidatedPath(oldPath, 'oldPath'),
1250 getValidatedPath(newPath, 'newPath'),
1251 );
1252}
1253
1254/**
1255 * Truncates the file.

Callers 3

testRenameFunction · 0.50
runTestsFunction · 0.50

Calls 2

renameSyncMethod · 0.45
renameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…