node.js中的fs.symlink方法使用说明
方法说明:
创建符号链接。
语法:
fs.symlink(srcpath, dstpath, [type], [callback(err)])
由于该方法属于fs模块,使用前需要引入fs模块(var fs= require(“fs”) )
接收参数:
srcpath 为源目录或文件的路径
dstpath 它是存放转换后的目录的路径,默认为当前工作目录
type 默认值:'file' , 可选值 ‘dir', ‘file', 或者 ‘junction' ,该项仅用于Windows(在其他平台上忽略)。
注意Windows结点需要转换后的目录是绝对路径,使用“junction”时,目标参数将自动被归一化到的绝对路径。
callback 回调,传递一个异常参数err
源码:
fs.symlink = function(destination, path, type_, callback) {
var type = (util.isString(type_) ? type_ : null);
var callback = makeCallback(arguments[arguments.length - 1]);
if (!nullCheck(destination, callback)) return;
if (!nullCheck(path, callback)) return;
binding.symlink(preprocessSymlinkDestination(destination, type),
pathModule._makeLong(path),
type,
callback);
};
相关文章
npm报错:request to httpsregistry.npm.taobao.org 
这篇文章主要介绍了npm报错:request to httpsregistry.npm.taobao.org failed, reason certificate has expired的解决方案,文中有详细的解决方案,需要的朋友可以参考下2024-03-03
Node.JS在命令行中检查Chrome浏览器是否安装并打开指定网址
这篇文章主要介绍了Node.JS在命令行中检查Chrome浏览器是否安装,并打开指定网址,本文通过实例代码给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下2019-05-05


最新评论