Method description:
Synchronous version of chmod(), which is used to overwrite the read and write permissions of the file.
grammar:
fs.chmodSync(path, mode)
Since this method belongs to the fs module, it is necessary to introduce the fs module before use (var fs = require("fs") )
Receive parameters:
1. path file path
2. Mode read and write permissions (such as: 777)
example:
The code copy is as follows:
var fs = require('fs'),
oldFilename = "./processId.txt";
fs.chmodSync(oldFilename, 777);
Source code:
The code copy is as follows:
fs.chmodSync = function(path, mode) {
nullCheck(path);
return binding.chmod(pathModule._makeLong(path), modeNum(mode));
};