| 1500 | } |
| 1501 | |
| 1502 | async 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 | |
| 1517 | async function truncate(path, len = 0) { |
| 1518 | const h = vfsState.handlers; |