Add batch 7 (XUANTIE-RV_openc906, osresearch_spispy, efabless_caravel, ZipCPU_sdspi, Nitcloud_Digital-IDE)
7ca5cf2 verified Download Nitcloud_Digital-IDE/node_modules/HDLfilesys/operation/path.js from SAIFIINDUSTRIES/verilog_data-1: direct link, hf CLI and curl.
- Browser
- Download file 1.76 kB
-
https://huggingface.co/datasets/SAIFIINDUSTRIES/verilog_data-1/resolve/main/Nitcloud_Digital-IDE/node_modules/HDLfilesys/operation/path.js
- Command line
-
hf download hf://datasets/SAIFIINDUSTRIES/verilog_data-1/Nitcloud_Digital-IDE/node_modules/HDLfilesys/operation/path.js
-
curl -L -o path.js https://huggingface.co/datasets/SAIFIINDUSTRIES/verilog_data-1/resolve/main/Nitcloud_Digital-IDE/node_modules/HDLfilesys/operation/path.js
1.76 kB
| ; | |
| const fspath = require("path"); | |
| var pathOperation = { | |
| log : console.log, | |
| /** | |
| * @descriptionCn 相对路径转绝对路径 | |
| * @descriptionEn turn relative path to absolute path | |
| * @param {String} curPath current file path | |
| * @param {String} path the path which is included in the current file | |
| * @returns absolute path | |
| */ | |
| rel2abs : function (curPath, path) { | |
| // check whether it is absolute | |
| if (fspath.isAbsolute(path)) { | |
| return path; | |
| } | |
| let parent = fspath.dirname(curPath); | |
| let absPath = fspath.resolve(parent, path); | |
| return absPath.replace(/\\/g,"\/"); | |
| }, | |
| /** | |
| * @descriptionCn 获取文件的后缀 | |
| * @descriptionEn get the extname of path | |
| * @param {String} path the path which is included in the current file | |
| * @returns the extname of path e.g. : ".txt" | |
| */ | |
| extname : function (path) { | |
| return fspath.extname(path).toLowerCase(); | |
| }, | |
| basename : function (path) { | |
| return fspath.basename(path); | |
| }, | |
| /** | |
| * @descriptionEn Multiple times return the directory name of a path. | |
| * @descriptionCn 往上进行指定次数的父级路径查找 | |
| * @param {String} path 初始文件路径 | |
| * @param {Number} times 往上查找的次数,省缺时指定为一次 | |
| * @returns {String} 返回对应的父级路径 | |
| */ | |
| dirname : function (path, times) { | |
| let dirPath = path; | |
| if (!times) { | |
| dirPath = fspath.dirname(dirPath); | |
| return dirPath; | |
| } | |
| for (let i = 0; i < times; i++) { | |
| dirPath = fspath.dirname(dirPath); | |
| } | |
| return dirPath; | |
| } | |
| } | |
| module.exports = pathOperation; |