方法說明
fs.link() 的同步版本,用來建立硬鏈接。
語法
fs.linkSync(srcpath, dstpath)
此方式屬於 fs 模組,使用前必須先引入:var fs = require("fs")
參數說明
srcpath:來源目錄或檔案的路徑。
dstpath:存放鏈接的路徑,預設為目前工作目錄。
原始碼
fs.linkSync = function(srcpath, dstpath) {
nullCheck(srcpath);
nullCheck(dstpath);
return binding.link(pathModule._makeLong(srcpath),
pathModule._makeLong(dstpath));
};