This article mainly introduces node. fs. fchownSync method usage instructions. This article introduces fs. fchownSync method description, syntax, receiving parameters, use instances, and implementation source code. For more information, see
Method description:
Synchronous version of fchown ().
Syntax:
The Code is as follows:
Fs. fchownSync (fd, uid, gid)
Because this method belongs to the fs module, we need to introduce the fs module (var fs = require ("fs") before use "))
Receiving parameters:
Fd file descriptor
Uid user ID
Gid group identity (the identity of the user of the shared resource system)
Example:
The Code 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 is as follows:
Fs. fchownSync = function (fd, uid, gid ){
Return binding. fchown (fd, uid, gid );
};