Method Description:
Change file ownership (no parsing of symbolic links).
Grammar:
Copy Code code as follows:
Fs.lchown (path, UID, GID, [Callback (ERR)])
Because this method belongs to the FS module, it is necessary to introduce FS module (VAR fs= require ("FS") before use.
Receive parameters:
Path directory paths
UID User ID
GID group identity (refers to the identity of a shared resource system user)
Callback callback, passing exception parameter err
Example:
Copy Code code as follows:
Fs.lchown (' Content.txt ', uid, GID, function (err) {
if (err) {
Console.log (ERR);
}else{
Console.log ("Change Done");
}
})
Source:
Copy Code code as follows:
Fs.lchown = function (path, UID, GID, callback) {
callback = Maybecallback (callback);
Fs.open (Path, constants. o_wronly | Constants. O_symlink, function (err, FD) {
if (err) {
Callback (ERR);
Return
}
Fs.fchown (FD, UID, GID, callback);
});
};