這篇文章主要介紹了node.js中的fs.linkSync方法使用說明,本文介紹了fs.linkSync的方法說明、語法、接收參數(shù)、使用實例和實現(xiàn)源碼,需要的朋友可以參考下
方法說明:
同步版的 fs.link() 。
語法:
復(fù)制代碼代碼如下:
fs.linkSync(srcpath, dstpath)
由于該方法屬于fs模塊,使用前需要引入fs模塊(var fs= require(“fs”) )
接收參數(shù):
srcpath 為源目錄或文件的路徑
dstpath 它是存放轉(zhuǎn)換后的目錄的路徑,默認(rèn)為當(dāng)前工作目錄
源碼:
復(fù)制代碼代碼如下:
fs.linkSync = function(srcpath, dstpath) {
nullCheck(srcpath);
nullCheck(dstpath);
return binding.link(pathModule._makeLong(srcpath),
pathModule._makeLong(dstpath));
};