Method description:
Synchronous version of fchown().
grammar:
The code copy is as follows:
fs.fchownSync(fd, uid, gid)
Since this method belongs to the FS module, it is necessary to introduce the FS module before use (var fs= require("fs") )
Receive parameters:
fd file descriptor
uid user ID
gid group identity (refers to the identity of the user of the shared resource system)
example:
The code copy is as follows:
fs.open('content.txt', 'a', function (err, fd) {
if (err) {
throw err;
}
fs.fchownSync(fd, uid, gid);
fs.close(fd, function () {
console.log('Done');
});
});
Source code:
The code copy is as follows:
fs.fchownSync = function(fd, uid, gid) {
return binding.fchown(fd, uid, gid);
};