Heim > Web-Frontend > js-Tutorial > Hauptteil

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

WBOY
Freigeben: 2016-05-16 16:27:02
Original
1306 Leute haben es durchsucht

方法说明:

创建符号链接。

语法:

复制代码 代码如下:

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);
};
Verwandte Etiketten:
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!