Instructions for the fs.lchownSync method in node.js

  • 2020-05-07 19:09:50
  • OfStack

method description:

lchown().

syntax:


fs.lchownSync(path, uid, gid)

Since this method belongs to the fs module, the fs module (var fs= require(" fs ")) needs to be introduced before use.

receive parameter:

path                 directory path

uid                     user ID

gid                       group identity

example:


fs.lchownSync('content.txt', uid, gid);

source code:


fs.lchownSync = function(path, uid, gid) {
    var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK);
    return fs.fchownSync(fd, uid, gid);
};


Related articles: