This article mainly introduces node. fs. the lchmodSync method is described in this article. lchmodSync method description, syntax, receiving parameters, use instances and implementation source code. For more information, see
Method description:
Synchronous version of lchmod ().
Syntax:
The Code is as follows:
Fs. lchmodSync (fd, mode)
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
Mode File Permission
Source code:
The Code is as follows:
Fs. lchmodSync = function (path, mode ){
Var fd = fs. openSync (path, constants. O_WRONLY | constants. O_SYMLINK );
// Prefer to return the chmod error, if one occurs,
// But still try to close, and report closing errors if they occur.
Var err, err2;
Try {
Var ret = fs. fchmodSync (fd, mode );
} Catch (er ){
Err = er;
}
Try {
Fs. closeSync (fd );
} Catch (er ){
Err2 = er;
}
If (err | err2) throw (err | err2 );
Return ret;
};
}