Home  >  Article  >  Web Front-end  >  node.js中的fs.lchownSync方法使用说明_node.js

node.js中的fs.lchownSync方法使用说明_node.js

WBOY
WBOYOriginal
2016-05-16 16:26:221497browse

方法说明:

同步版的 lchown()

语法:

复制代码 代码如下:

fs.lchownSync(path, uid, gid)

由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) )

接收参数:

path          目录路径

uid            用户ID

gid            群体身份 (指共享资源系统使用者的身份)

例子:

复制代码 代码如下:

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

源码:

复制代码 代码如下:

fs.lchownSync = function(path, uid, gid) {
    var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK);
    return fs.fchownSync(fd, uid, gid);
};
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn