<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>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## Path 模塊 path模塊提供了一些用于處理文件路徑的小工具 Windows 與 POSI(可移植操作系統接口, Portable Operating System Interface of UNIX) path 模塊會因操作系統的差異而不同。 比如在 Windows 上,path 模塊會認為使用的是 Windows 風格的路徑。 例如,對文件路徑 C:\temp\myfile.html 使用 path.basename(),在 POSIX 上與在 Windows 上會產生不同的結果 在 POSIX 上: ~~~ path.basename('C:\\temp\\myfile.html'); // 返回: 'C:\\temp\\myfile.html' ~~~ 在 Windows 上: ~~~ path.basename('C:\\temp\\myfile.html'); // 返回: 'myfile.html' ~~~ 要想在任何操作系統上處理 Windows 文件路徑時獲得一致的結果,可以使用 path.win32: 在 POSIX 和 Windows 上: ~~~ path.win32.basename('C:\\temp\\myfile.html'); // 返回: 'myfile.html' ~~~ 如果想在任何操作系統上處理 POSIX 文件路徑時獲得一致的結果,則使用 path.posix: 在 POSIX 和 Windows 上: ~~~ path.posix.basename('/tmp/myfile.html'); // 返回: 'myfile.html' ~~~ 1.path.basename ~~~ path.basename('/foo/bar/baz/asdf/quux.html'); // 返回: 'quux.html' path.basename('/foo/bar/baz/asdf/quux.html', '.html'); // 返回: 'quux' ~~~ 2.path.dirname(path) ~~~ path.dirname('/foo/bar/baz/asdf/quux'); // 返回: '/foo/bar/baz/asdf' ~~~ 3.path.extname(path) ~~~ path.extname('index.html'); // 返回: '.html' path.extname('index.coffee.md'); // 返回: '.md' path.extname('index.'); // 返回: '.' path.extname('index'); // 返回: '' path.extname('.index'); // 返回: '' ~~~ 4.path.format(pathObject) ~~~ // 如果指定了 `dir`、`root` 和 `base`,則返回 `${dir}${path.sep}${base}`。 // `root` 會被忽略。 path.format({ root: '/ignored', dir: '/home/user/dir', base: 'file.txt' }); // 返回: '/home/user/dir/file.txt' // 如果沒有指定 `dir`,則使用 `root`。 // 如果只指定了 `root` 或 `dir` 等于 `root`,則不會包含分隔符。 // `ext` 會被忽略。 path.format({ root: '/', base: 'file.txt', ext: 'ignored' }); // 返回: '/file.txt' // 如果沒有指定 `base`,則使用 `name` + `ext`。 path.format({ root: '/', name: 'file', ext: '.txt' }); // 返回: '/file.txt' ~~~ 5.path.isAbsolute(path) ~~~ path.isAbsolute('/foo/bar'); // true path.isAbsolute('/baz/..'); // true path.isAbsolute('qux/'); // false path.isAbsolute('.'); // false ~~~ 6.path.join([...paths]) ~~~ path.join('/foo', 'bar', 'baz/asdf', 'quux', '..'); // 返回: '/foo/bar/baz/asdf' path.join('foo', {}, 'bar'); // 拋出 'TypeError: Path must be a string. Received {}' ~~~ 7.path.parse(path) ~~~ path.parse('/home/user/dir/file.txt'); ~~~ 8.path.resolve([...paths]) ~~~ path.resolve('/foo/bar', './baz'); // 返回: '/foo/bar/baz' path.resolve('/foo/bar', '/tmp/file/'); // 返回: '/tmp/file' path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif'); // 如果當前工作目錄是 /home/myself/node,則返回 '/home/myself/node/wwwroot/static_files/gif/image.gif' ~~~ 9.path.normalize ~~~ path.normalize('/foo/bar//baz/asdf/quux/..'); // 返回: '/foo/bar/baz/asdf' ~~~ ~~~ path.normalize('C:\\temp\\\\foo\\bar\\..\\'); // 返回: 'C:\\temp\\foo\\' ~~~
                  <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>

                              哎呀哎呀视频在线观看