node.js中的fs.symlinkSync方法使用說明
方法說明:
同步版的 symlink() 。用于創(chuàng)建符號鏈接。
語法:
fs.symlinkSync(srcpath, dstpath, [type])
由于該方法屬于fs模塊,使用前需要引入fs模塊(var fs= require(“fs”) )
接收參數:
srcpath 為源目錄或文件的路徑
dstpath 它是存放轉換后的目錄的路徑,默認為當前工作目錄
type 默認值:'file' , 可選值 ‘dir', ‘file', 或者 ‘junction' ,該項僅用于Windows(在其他平臺上忽略)。
注意Windows結點需要轉換后的目錄是絕對路徑,使用“junction”時,目標參數將自動被歸一化到的絕對路徑。
源碼:
fs.symlinkSync = function(destination, path, type) {
type = (util.isString(type) ? type : null);
nullCheck(destination);
nullCheck(path);
return binding.symlink(preprocessSymlinkDestination(destination, type),
pathModule._makeLong(path),
type);
};
相關文章
node.js+postman+mongodb搭建測試注冊接口的實現
本文主要介紹了node.js+postman+mongodb搭建測試注冊接口的實現,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-06-06