Method description:
Synchronous version of rename().
grammar:
The code copy is as follows:
fs.renameSync(oldPath, newPath)
Since this method belongs to the FS module, it is necessary to introduce the FS module before use (var fs= require("fs") )
Receive parameters:
oldPath original path
newPath new path
example:
The code copy is as follows:
var fs = require('fs');
fs.renameSync('125.txt','126.txt');
Source code:
The code copy is as follows:
fs.renameSync = function(oldPath, newPath) {
nullCheck(oldPath);
nullCheck(newPath);
return binding.rename(pathModule._makeLong(oldPath),
pathModule._makeLong(newPath));
};