加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

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

发布时间:2016-11-24 13:36:27 所属栏目:Linux 来源:站长网
导读:方法说明: 创建硬链接。 语法: 复制代码 代码如下: fs.link(srcpath, dstpath, [callback(err)]) 由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) ) 接收参数: srcpathnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 为源目录或文件的路

方法说明:

创建硬链接。

语法:

复制代码 代码如下:
fs.link(srcpath, dstpath, [callback(err)])

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

接收参数:

srcpathnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 为源目录或文件的路径

dstpathnbsp;nbsp;nbsp;nbsp;nbsp;nbsp; 它是存放转换后的目录的路径,默认为当前工作目录

callbacknbsp;nbsp;nbsp;nbsp;nbsp; 回调,传递一个err异常参数

源码:

复制代码 代码如下:
fs.link = function(srcpath, dstpath, callback) {
nbsp; callback = makeCallback(callback);
nbsp; if (!nullCheck(srcpath, callback)) return;
nbsp; if (!nullCheck(dstpath, callback)) return;
nbsp; binding.link(pathModule._makeLong(srcpath),
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; pathModule._makeLong(dstpath),
nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp; callback);
};

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读