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

Function rename

lib/fs.js:1220–1232  ·  view source on GitHub ↗

* Asynchronously renames file at `oldPath` to * the pathname provided as `newPath`. * @param {string | Buffer | URL} oldPath * @param {string | Buffer | URL} newPath * @param {(err?: Error) => any} callback * @returns {void}

(oldPath, newPath, callback)

Source from the content-addressed store, hash-verified

1218 * @returns {void}
1219 */
1220function rename(oldPath, newPath, callback) {
1221 const h = vfsState.handlers;
1222 if (h !== null && vfsVoid(h.rename(oldPath, newPath), callback)) return;
1223
1224 callback = makeCallback(callback);
1225 const req = new FSReqCallback();
1226 req.oncomplete = callback;
1227 binding.rename(
1228 getValidatedPath(oldPath, 'oldPath'),
1229 getValidatedPath(newPath, 'newPath'),
1230 req,
1231 );
1232}
1233
1234
1235/**

Callers

nothing calls this directly

Calls 3

vfsVoidFunction · 0.85
makeCallbackFunction · 0.70
renameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…