This article mainly introduces node. fs. the lchownSync method is described in this article. lchownSync method description, syntax, receiving parameters, use instances, and implementation source code. For more information, see
Method description:
Synchronous version of lchown ().
Syntax:
The code is as follows:
Fs. lchownSync (path, 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:
Path directory path
Uid user ID
Gid group identity (the identity of the user of the shared resource system)
Example:
The code is as follows:
Fs.lchownSync('content.txt ', uid, gid );
Source code:
The code is as follows:
Fs. lchownSync = function (path, uid, gid ){
Var fd = fs. openSync (path, constants. O_WRONLY | constants. O_SYMLINK );
Return fs. fchownSync (fd, uid, gid );
};