<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # Node.js Path 模塊 Node.js path 模塊提供了一些用于處理文件路徑的小工具,我們可以通過以下方式引入該模塊: ``` var path = require("path") ``` ### 方法 | 方法 | 描述 | | --- | --- | | **path.normalize(p)** | 規范化路徑,注意'..' 和 '.'。 | | **path.join([path1][, path2][, ...])** | 用于連接路徑。該方法的主要用途在于,會正確使用當前系統的路徑分隔符,Unix系統是"/",Windows系統是"\"。 | | **path.resolve([from ...], to)** | 將 **to** 參數解析為絕對路徑。 | | **path.isAbsolute(path)** | 判斷參數 **path** 是否是絕對路徑。 | | **path.relative(from, to)** | 用于將相對路徑轉為絕對路徑。 | | **path.dirname(p)** | 返回路徑中代表文件夾的部分,同 Unix 的dirname 命令類似。 | | **path.basename(p[, ext])** | 返回路徑中的最后一部分。同 Unix 命令 bashname 類似。 | | **path.extname(p)** | 返回路徑中文件的后綴名,即路徑中最后一個'.'之后的部分。如果一個路徑中并不包含'.'或該路徑只包含一個'.' 且這個'.'為路徑的第一個字符,則此命令返回空字符串。 | | **path.parse(pathString)** | 返回路徑字符串的對象。 | | **path.format(pathObject)** | 從對象中返回路徑字符串,和 path.parse 相反。 | ### 屬性 | 屬性 | 描述 | | --- | --- | | **path.sep** | 平臺的文件路徑分隔符,'\\' 或 '/'。 | | **path.delimiter** | 平臺的分隔符, ; or ':'. | | **path.posix** | 提供上述 path 的方法,不過總是以 posix 兼容的方式交互。 | | **path.win32** | 提供上述 path 的方法,不過總是以 win32 兼容的方式交互。 | ### 實例 創建 main.js 文件,代碼如下所示: ``` var path = require("path"); // 格式化路徑 console.log('normalization : ' + path.normalize('/test/test1//2slashes/1slash/tab/..')); // 連接路徑 console.log('joint path : ' + path.join('/test', 'test1', '2slashes/1slash', 'tab', '..')); // 轉換為絕對路徑 console.log('resolve : ' + path.resolve('main.js')); // 路徑中文件的后綴名 console.log('ext name : ' + path.extname('main.js')); ``` 代碼執行結果如下: ``` $ node main.js normalization : /test/test1/2slashes/1slash joint path : /test/test1/2slashes/1slash resolve : /web/com/1427176256_27423/main.js ext name : .js ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看