MCPcopy Create free account
hub / github.com/nodejs/node / rename

Function rename

lib/internal/fs/promises.js:1502–1515  ·  view source on GitHub ↗
(oldPath, newPath)

Source from the content-addressed store, hash-verified

1500}
1501
1502async function rename(oldPath, newPath) {
1503 const h = vfsState.handlers;
1504 if (h !== null) {
1505 const promise = h.rename(oldPath, newPath);
1506 if (promise !== undefined) { await promise; return; }
1507 }
1508 oldPath = getValidatedPath(oldPath, 'oldPath');
1509 newPath = getValidatedPath(newPath, 'newPath');
1510 return await PromisePrototypeThen(
1511 binding.rename(oldPath, newPath, kUsePromises),
1512 undefined,
1513 handleErrorFromBinding,
1514 );
1515}
1516
1517async function truncate(path, len = 0) {
1518 const h = vfsState.handlers;

Callers

nothing calls this directly

Calls 1

renameMethod · 0.45

Tested by

no test coverage detected