1{ 2 "type": "module", 3 "source": "doc/api/path.md", 4 "modules": [ 5 { 6 "textRaw": "Path", 7 "name": "path", 8 "introduced_in": "v0.10.0", 9 "stability": 2, 10 "stabilityText": "Stable", 11 "desc": "<p><strong>Source Code:</strong> <a href=\"https://github.com/nodejs/node/blob/v14.21.2/lib/path.js\">lib/path.js</a></p>\n<p>The <code>path</code> module provides utilities for working with file and directory paths.\nIt can be accessed using:</p>\n<pre><code class=\"language-js\">const path = require('path');\n</code></pre>", 12 "modules": [ 13 { 14 "textRaw": "Windows vs. POSIX", 15 "name": "windows_vs._posix", 16 "desc": "<p>The default operation of the <code>path</code> module varies based on the operating system\non which a Node.js application is running. Specifically, when running on a\nWindows operating system, the <code>path</code> module will assume that Windows-style\npaths are being used.</p>\n<p>So using <code>path.basename()</code> might yield different results on POSIX and Windows:</p>\n<p>On POSIX:</p>\n<pre><code class=\"language-js\">path.basename('C:\\\\temp\\\\myfile.html');\n// Returns: 'C:\\\\temp\\\\myfile.html'\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">path.basename('C:\\\\temp\\\\myfile.html');\n// Returns: 'myfile.html'\n</code></pre>\n<p>To achieve consistent results when working with Windows file paths on any\noperating system, use <a href=\"#path_path_win32\"><code>path.win32</code></a>:</p>\n<p>On POSIX and Windows:</p>\n<pre><code class=\"language-js\">path.win32.basename('C:\\\\temp\\\\myfile.html');\n// Returns: 'myfile.html'\n</code></pre>\n<p>To achieve consistent results when working with POSIX file paths on any\noperating system, use <a href=\"#path_path_posix\"><code>path.posix</code></a>:</p>\n<p>On POSIX and Windows:</p>\n<pre><code class=\"language-js\">path.posix.basename('/tmp/myfile.html');\n// Returns: 'myfile.html'\n</code></pre>\n<p>On Windows Node.js follows the concept of per-drive working directory.\nThis behavior can be observed when using a drive path without a backslash. For\nexample, <code>path.resolve('C:\\\\')</code> can potentially return a different result than\n<code>path.resolve('C:')</code>. For more information, see\n<a href=\"https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#fully-qualified-vs-relative-paths\">this MSDN page</a>.</p>", 17 "type": "module", 18 "displayName": "Windows vs. POSIX" 19 } 20 ], 21 "methods": [ 22 { 23 "textRaw": "`path.basename(path[, ext])`", 24 "type": "method", 25 "name": "basename", 26 "meta": { 27 "added": [ 28 "v0.1.25" 29 ], 30 "changes": [ 31 { 32 "version": "v6.0.0", 33 "pr-url": "https://github.com/nodejs/node/pull/5348", 34 "description": "Passing a non-string as the `path` argument will throw now." 35 } 36 ] 37 }, 38 "signatures": [ 39 { 40 "return": { 41 "textRaw": "Returns: {string}", 42 "name": "return", 43 "type": "string" 44 }, 45 "params": [ 46 { 47 "textRaw": "`path` {string}", 48 "name": "path", 49 "type": "string" 50 }, 51 { 52 "textRaw": "`ext` {string} An optional file extension", 53 "name": "ext", 54 "type": "string", 55 "desc": "An optional file extension" 56 } 57 ] 58 } 59 ], 60 "desc": "<p>The <code>path.basename()</code> method returns the last portion of a <code>path</code>, similar to\nthe Unix <code>basename</code> command. Trailing directory separators are ignored, see\n<a href=\"#path_path_sep\"><code>path.sep</code></a>.</p>\n<pre><code class=\"language-js\">path.basename('/foo/bar/baz/asdf/quux.html');\n// Returns: 'quux.html'\n\npath.basename('/foo/bar/baz/asdf/quux.html', '.html');\n// Returns: 'quux'\n</code></pre>\n<p>Although Windows usually treats file names, including file extensions, in a\ncase-insensitive manner, this function does not. For example, <code>C:\\\\foo.html</code> and\n<code>C:\\\\foo.HTML</code> refer to the same file, but <code>basename</code> treats the extension as a\ncase-sensitive string:</p>\n<pre><code class=\"language-js\">path.win32.basename('C:\\\\foo.html', '.html');\n// Returns: 'foo'\n\npath.win32.basename('C:\\\\foo.HTML', '.html');\n// Returns: 'foo.HTML'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if <code>path</code> is not a string or if <code>ext</code> is given\nand is not a string.</p>" 61 }, 62 { 63 "textRaw": "`path.dirname(path)`", 64 "type": "method", 65 "name": "dirname", 66 "meta": { 67 "added": [ 68 "v0.1.16" 69 ], 70 "changes": [ 71 { 72 "version": "v6.0.0", 73 "pr-url": "https://github.com/nodejs/node/pull/5348", 74 "description": "Passing a non-string as the `path` argument will throw now." 75 } 76 ] 77 }, 78 "signatures": [ 79 { 80 "return": { 81 "textRaw": "Returns: {string}", 82 "name": "return", 83 "type": "string" 84 }, 85 "params": [ 86 { 87 "textRaw": "`path` {string}", 88 "name": "path", 89 "type": "string" 90 } 91 ] 92 } 93 ], 94 "desc": "<p>The <code>path.dirname()</code> method returns the directory name of a <code>path</code>, similar to\nthe Unix <code>dirname</code> command. Trailing directory separators are ignored, see\n<a href=\"#path_path_sep\"><code>path.sep</code></a>.</p>\n<pre><code class=\"language-js\">path.dirname('/foo/bar/baz/asdf/quux');\n// Returns: '/foo/bar/baz/asdf'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if <code>path</code> is not a string.</p>" 95 }, 96 { 97 "textRaw": "`path.extname(path)`", 98 "type": "method", 99 "name": "extname", 100 "meta": { 101 "added": [ 102 "v0.1.25" 103 ], 104 "changes": [ 105 { 106 "version": "v6.0.0", 107 "pr-url": "https://github.com/nodejs/node/pull/5348", 108 "description": "Passing a non-string as the `path` argument will throw now." 109 } 110 ] 111 }, 112 "signatures": [ 113 { 114 "return": { 115 "textRaw": "Returns: {string}", 116 "name": "return", 117 "type": "string" 118 }, 119 "params": [ 120 { 121 "textRaw": "`path` {string}", 122 "name": "path", 123 "type": "string" 124 } 125 ] 126 } 127 ], 128 "desc": "<p>The <code>path.extname()</code> method returns the extension of the <code>path</code>, from the last\noccurrence of the <code>.</code> (period) character to end of string in the last portion of\nthe <code>path</code>. If there is no <code>.</code> in the last portion of the <code>path</code>, or if\nthere are no <code>.</code> characters other than the first character of\nthe basename of <code>path</code> (see <code>path.basename()</code>) , an empty string is returned.</p>\n<pre><code class=\"language-js\">path.extname('index.html');\n// Returns: '.html'\n\npath.extname('index.coffee.md');\n// Returns: '.md'\n\npath.extname('index.');\n// Returns: '.'\n\npath.extname('index');\n// Returns: ''\n\npath.extname('.index');\n// Returns: ''\n\npath.extname('.index.md');\n// Returns: '.md'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if <code>path</code> is not a string.</p>" 129 }, 130 { 131 "textRaw": "`path.format(pathObject)`", 132 "type": "method", 133 "name": "format", 134 "meta": { 135 "added": [ 136 "v0.11.15" 137 ], 138 "changes": [] 139 }, 140 "signatures": [ 141 { 142 "return": { 143 "textRaw": "Returns: {string}", 144 "name": "return", 145 "type": "string" 146 }, 147 "params": [ 148 { 149 "textRaw": "`pathObject` {Object} Any JavaScript object having the following properties:", 150 "name": "pathObject", 151 "type": "Object", 152 "desc": "Any JavaScript object having the following properties:", 153 "options": [ 154 { 155 "textRaw": "`dir` {string}", 156 "name": "dir", 157 "type": "string" 158 }, 159 { 160 "textRaw": "`root` {string}", 161 "name": "root", 162 "type": "string" 163 }, 164 { 165 "textRaw": "`base` {string}", 166 "name": "base", 167 "type": "string" 168 }, 169 { 170 "textRaw": "`name` {string}", 171 "name": "name", 172 "type": "string" 173 }, 174 { 175 "textRaw": "`ext` {string}", 176 "name": "ext", 177 "type": "string" 178 } 179 ] 180 } 181 ] 182 } 183 ], 184 "desc": "<p>The <code>path.format()</code> method returns a path string from an object. This is the\nopposite of <a href=\"#path_path_parse_path\"><code>path.parse()</code></a>.</p>\n<p>When providing properties to the <code>pathObject</code> remember that there are\ncombinations where one property has priority over another:</p>\n<ul>\n<li><code>pathObject.root</code> is ignored if <code>pathObject.dir</code> is provided</li>\n<li><code>pathObject.ext</code> and <code>pathObject.name</code> are ignored if <code>pathObject.base</code> exists</li>\n</ul>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">// If `dir`, `root` and `base` are provided,\n// `${dir}${path.sep}${base}`\n// will be returned. `root` is ignored.\npath.format({\n root: '/ignored',\n dir: '/home/user/dir',\n base: 'file.txt'\n});\n// Returns: '/home/user/dir/file.txt'\n\n// `root` will be used if `dir` is not specified.\n// If only `root` is provided or `dir` is equal to `root` then the\n// platform separator will not be included. `ext` will be ignored.\npath.format({\n root: '/',\n base: 'file.txt',\n ext: 'ignored'\n});\n// Returns: '/file.txt'\n\n// `name` + `ext` will be used if `base` is not specified.\npath.format({\n root: '/',\n name: 'file',\n ext: '.txt'\n});\n// Returns: '/file.txt'\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">path.format({\n dir: 'C:\\\\path\\\\dir',\n base: 'file.txt'\n});\n// Returns: 'C:\\\\path\\\\dir\\\\file.txt'\n</code></pre>" 185 }, 186 { 187 "textRaw": "`path.isAbsolute(path)`", 188 "type": "method", 189 "name": "isAbsolute", 190 "meta": { 191 "added": [ 192 "v0.11.2" 193 ], 194 "changes": [] 195 }, 196 "signatures": [ 197 { 198 "return": { 199 "textRaw": "Returns: {boolean}", 200 "name": "return", 201 "type": "boolean" 202 }, 203 "params": [ 204 { 205 "textRaw": "`path` {string}", 206 "name": "path", 207 "type": "string" 208 } 209 ] 210 } 211 ], 212 "desc": "<p>The <code>path.isAbsolute()</code> method determines if <code>path</code> is an absolute path.</p>\n<p>If the given <code>path</code> is a zero-length string, <code>false</code> will be returned.</p>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">path.isAbsolute('/foo/bar'); // true\npath.isAbsolute('/baz/..'); // true\npath.isAbsolute('qux/'); // false\npath.isAbsolute('.'); // false\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">path.isAbsolute('//server'); // true\npath.isAbsolute('\\\\\\\\server'); // true\npath.isAbsolute('C:/foo/..'); // true\npath.isAbsolute('C:\\\\foo\\\\..'); // true\npath.isAbsolute('bar\\\\baz'); // false\npath.isAbsolute('bar/baz'); // false\npath.isAbsolute('.'); // false\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if <code>path</code> is not a string.</p>" 213 }, 214 { 215 "textRaw": "`path.join([...paths])`", 216 "type": "method", 217 "name": "join", 218 "meta": { 219 "added": [ 220 "v0.1.16" 221 ], 222 "changes": [] 223 }, 224 "signatures": [ 225 { 226 "return": { 227 "textRaw": "Returns: {string}", 228 "name": "return", 229 "type": "string" 230 }, 231 "params": [ 232 { 233 "textRaw": "`...paths` {string} A sequence of path segments", 234 "name": "...paths", 235 "type": "string", 236 "desc": "A sequence of path segments" 237 } 238 ] 239 } 240 ], 241 "desc": "<p>The <code>path.join()</code> method joins all given <code>path</code> segments together using the\nplatform-specific separator as a delimiter, then normalizes the resulting path.</p>\n<p>Zero-length <code>path</code> segments are ignored. If the joined path string is a\nzero-length string then <code>'.'</code> will be returned, representing the current\nworking directory.</p>\n<pre><code class=\"language-js\">path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');\n// Returns: '/foo/bar/baz/asdf'\n\npath.join('foo', {}, 'bar');\n// Throws 'TypeError: Path must be a string. Received {}'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if any of the path segments is not a string.</p>" 242 }, 243 { 244 "textRaw": "`path.normalize(path)`", 245 "type": "method", 246 "name": "normalize", 247 "meta": { 248 "added": [ 249 "v0.1.23" 250 ], 251 "changes": [] 252 }, 253 "signatures": [ 254 { 255 "return": { 256 "textRaw": "Returns: {string}", 257 "name": "return", 258 "type": "string" 259 }, 260 "params": [ 261 { 262 "textRaw": "`path` {string}", 263 "name": "path", 264 "type": "string" 265 } 266 ] 267 } 268 ], 269 "desc": "<p>The <code>path.normalize()</code> method normalizes the given <code>path</code>, resolving <code>'..'</code> and\n<code>'.'</code> segments.</p>\n<p>When multiple, sequential path segment separation characters are found (e.g.\n<code>/</code> on POSIX and either <code>\\</code> or <code>/</code> on Windows), they are replaced by a single\ninstance of the platform-specific path segment separator (<code>/</code> on POSIX and\n<code>\\</code> on Windows). Trailing separators are preserved.</p>\n<p>If the <code>path</code> is a zero-length string, <code>'.'</code> is returned, representing the\ncurrent working directory.</p>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">path.normalize('/foo/bar//baz/asdf/quux/..');\n// Returns: '/foo/bar/baz/asdf'\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">path.normalize('C:\\\\temp\\\\\\\\foo\\\\bar\\\\..\\\\');\n// Returns: 'C:\\\\temp\\\\foo\\\\'\n</code></pre>\n<p>Since Windows recognizes multiple path separators, both separators will be\nreplaced by instances of the Windows preferred separator (<code>\\</code>):</p>\n<pre><code class=\"language-js\">path.win32.normalize('C:////temp\\\\\\\\/\\\\/\\\\/foo/bar');\n// Returns: 'C:\\\\temp\\\\foo\\\\bar'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if <code>path</code> is not a string.</p>" 270 }, 271 { 272 "textRaw": "`path.parse(path)`", 273 "type": "method", 274 "name": "parse", 275 "meta": { 276 "added": [ 277 "v0.11.15" 278 ], 279 "changes": [] 280 }, 281 "signatures": [ 282 { 283 "return": { 284 "textRaw": "Returns: {Object}", 285 "name": "return", 286 "type": "Object" 287 }, 288 "params": [ 289 { 290 "textRaw": "`path` {string}", 291 "name": "path", 292 "type": "string" 293 } 294 ] 295 } 296 ], 297 "desc": "<p>The <code>path.parse()</code> method returns an object whose properties represent\nsignificant elements of the <code>path</code>. Trailing directory separators are ignored,\nsee <a href=\"#path_path_sep\"><code>path.sep</code></a>.</p>\n<p>The returned object will have the following properties:</p>\n<ul>\n<li><code>dir</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\" class=\"type\"><string></a></li>\n<li><code>root</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\" class=\"type\"><string></a></li>\n<li><code>base</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\" class=\"type\"><string></a></li>\n<li><code>name</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\" class=\"type\"><string></a></li>\n<li><code>ext</code> <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type\" class=\"type\"><string></a></li>\n</ul>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">path.parse('/home/user/dir/file.txt');\n// Returns:\n// { root: '/',\n// dir: '/home/user/dir',\n// base: 'file.txt',\n// ext: '.txt',\n// name: 'file' }\n</code></pre>\n<pre><code class=\"language-text\">┌─────────────────────┬────────────┐\n│ dir │ base │\n├──────┬ ├──────┬─────┤\n│ root │ │ name │ ext │\n\" / home/user/dir / file .txt \"\n└──────┴──────────────┴──────┴─────┘\n(All spaces in the \"\" line should be ignored. They are purely for formatting.)\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">path.parse('C:\\\\path\\\\dir\\\\file.txt');\n// Returns:\n// { root: 'C:\\\\',\n// dir: 'C:\\\\path\\\\dir',\n// base: 'file.txt',\n// ext: '.txt',\n// name: 'file' }\n</code></pre>\n<pre><code class=\"language-text\">┌─────────────────────┬────────────┐\n│ dir │ base │\n├──────┬ ├──────┬─────┤\n│ root │ │ name │ ext │\n\" C:\\ path\\dir \\ file .txt \"\n└──────┴──────────────┴──────┴─────┘\n(All spaces in the \"\" line should be ignored. They are purely for formatting.)\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if <code>path</code> is not a string.</p>" 298 }, 299 { 300 "textRaw": "`path.relative(from, to)`", 301 "type": "method", 302 "name": "relative", 303 "meta": { 304 "added": [ 305 "v0.5.0" 306 ], 307 "changes": [ 308 { 309 "version": "v6.8.0", 310 "pr-url": "https://github.com/nodejs/node/pull/8523", 311 "description": "On Windows, the leading slashes for UNC paths are now included in the return value." 312 } 313 ] 314 }, 315 "signatures": [ 316 { 317 "return": { 318 "textRaw": "Returns: {string}", 319 "name": "return", 320 "type": "string" 321 }, 322 "params": [ 323 { 324 "textRaw": "`from` {string}", 325 "name": "from", 326 "type": "string" 327 }, 328 { 329 "textRaw": "`to` {string}", 330 "name": "to", 331 "type": "string" 332 } 333 ] 334 } 335 ], 336 "desc": "<p>The <code>path.relative()</code> method returns the relative path from <code>from</code> to <code>to</code> based\non the current working directory. If <code>from</code> and <code>to</code> each resolve to the same\npath (after calling <code>path.resolve()</code> on each), a zero-length string is returned.</p>\n<p>If a zero-length string is passed as <code>from</code> or <code>to</code>, the current working\ndirectory will be used instead of the zero-length strings.</p>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">path.relative('/data/orandea/test/aaa', '/data/orandea/impl/bbb');\n// Returns: '../../impl/bbb'\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">path.relative('C:\\\\orandea\\\\test\\\\aaa', 'C:\\\\orandea\\\\impl\\\\bbb');\n// Returns: '..\\\\..\\\\impl\\\\bbb'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if either <code>from</code> or <code>to</code> is not a string.</p>" 337 }, 338 { 339 "textRaw": "`path.resolve([...paths])`", 340 "type": "method", 341 "name": "resolve", 342 "meta": { 343 "added": [ 344 "v0.3.4" 345 ], 346 "changes": [] 347 }, 348 "signatures": [ 349 { 350 "return": { 351 "textRaw": "Returns: {string}", 352 "name": "return", 353 "type": "string" 354 }, 355 "params": [ 356 { 357 "textRaw": "`...paths` {string} A sequence of paths or path segments", 358 "name": "...paths", 359 "type": "string", 360 "desc": "A sequence of paths or path segments" 361 } 362 ] 363 } 364 ], 365 "desc": "<p>The <code>path.resolve()</code> method resolves a sequence of paths or path segments into\nan absolute path.</p>\n<p>The given sequence of paths is processed from right to left, with each\nsubsequent <code>path</code> prepended until an absolute path is constructed.\nFor instance, given the sequence of path segments: <code>/foo</code>, <code>/bar</code>, <code>baz</code>,\ncalling <code>path.resolve('/foo', '/bar', 'baz')</code> would return <code>/bar/baz</code>\nbecause <code>'baz'</code> is not an absolute path but <code>'/bar' + '/' + 'baz'</code> is.</p>\n<p>If, after processing all given <code>path</code> segments, an absolute path has not yet\nbeen generated, the current working directory is used.</p>\n<p>The resulting path is normalized and trailing slashes are removed unless the\npath is resolved to the root directory.</p>\n<p>Zero-length <code>path</code> segments are ignored.</p>\n<p>If no <code>path</code> segments are passed, <code>path.resolve()</code> will return the absolute path\nof the current working directory.</p>\n<pre><code class=\"language-js\">path.resolve('/foo/bar', './baz');\n// Returns: '/foo/bar/baz'\n\npath.resolve('/foo/bar', '/tmp/file/');\n// Returns: '/tmp/file'\n\npath.resolve('wwwroot', 'static_files/png/', '../gif/image.gif');\n// If the current working directory is /home/myself/node,\n// this returns '/home/myself/node/wwwroot/static_files/gif/image.gif'\n</code></pre>\n<p>A <a href=\"errors.html#errors_class_typeerror\"><code>TypeError</code></a> is thrown if any of the arguments is not a string.</p>" 366 }, 367 { 368 "textRaw": "`path.toNamespacedPath(path)`", 369 "type": "method", 370 "name": "toNamespacedPath", 371 "meta": { 372 "added": [ 373 "v9.0.0" 374 ], 375 "changes": [] 376 }, 377 "signatures": [ 378 { 379 "return": { 380 "textRaw": "Returns: {string}", 381 "name": "return", 382 "type": "string" 383 }, 384 "params": [ 385 { 386 "textRaw": "`path` {string}", 387 "name": "path", 388 "type": "string" 389 } 390 ] 391 } 392 ], 393 "desc": "<p>On Windows systems only, returns an equivalent <a href=\"https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#namespaces\">namespace-prefixed path</a> for\nthe given <code>path</code>. If <code>path</code> is not a string, <code>path</code> will be returned without\nmodifications.</p>\n<p>This method is meaningful only on Windows systems. On POSIX systems, the\nmethod is non-operational and always returns <code>path</code> without modifications.</p>" 394 } 395 ], 396 "properties": [ 397 { 398 "textRaw": "`delimiter` {string}", 399 "type": "string", 400 "name": "delimiter", 401 "meta": { 402 "added": [ 403 "v0.9.3" 404 ], 405 "changes": [] 406 }, 407 "desc": "<p>Provides the platform-specific path delimiter:</p>\n<ul>\n<li><code>;</code> for Windows</li>\n<li><code>:</code> for POSIX</li>\n</ul>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">console.log(process.env.PATH);\n// Prints: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'\n\nprocess.env.PATH.split(path.delimiter);\n// Returns: ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">console.log(process.env.PATH);\n// Prints: 'C:\\Windows\\system32;C:\\Windows;C:\\Program Files\\node\\'\n\nprocess.env.PATH.split(path.delimiter);\n// Returns ['C:\\\\Windows\\\\system32', 'C:\\\\Windows', 'C:\\\\Program Files\\\\node\\\\']\n</code></pre>" 408 }, 409 { 410 "textRaw": "`posix` {Object}", 411 "type": "Object", 412 "name": "posix", 413 "meta": { 414 "added": [ 415 "v0.11.15" 416 ], 417 "changes": [] 418 }, 419 "desc": "<p>The <code>path.posix</code> property provides access to POSIX specific implementations\nof the <code>path</code> methods.</p>" 420 }, 421 { 422 "textRaw": "`sep` {string}", 423 "type": "string", 424 "name": "sep", 425 "meta": { 426 "added": [ 427 "v0.7.9" 428 ], 429 "changes": [] 430 }, 431 "desc": "<p>Provides the platform-specific path segment separator:</p>\n<ul>\n<li><code>\\</code> on Windows</li>\n<li><code>/</code> on POSIX</li>\n</ul>\n<p>For example, on POSIX:</p>\n<pre><code class=\"language-js\">'foo/bar/baz'.split(path.sep);\n// Returns: ['foo', 'bar', 'baz']\n</code></pre>\n<p>On Windows:</p>\n<pre><code class=\"language-js\">'foo\\\\bar\\\\baz'.split(path.sep);\n// Returns: ['foo', 'bar', 'baz']\n</code></pre>\n<p>On Windows, both the forward slash (<code>/</code>) and backward slash (<code>\\</code>) are accepted\nas path segment separators; however, the <code>path</code> methods only add backward\nslashes (<code>\\</code>).</p>" 432 }, 433 { 434 "textRaw": "`win32` {Object}", 435 "type": "Object", 436 "name": "win32", 437 "meta": { 438 "added": [ 439 "v0.11.15" 440 ], 441 "changes": [] 442 }, 443 "desc": "<p>The <code>path.win32</code> property provides access to Windows-specific implementations\nof the <code>path</code> methods.</p>" 444 } 445 ], 446 "type": "module", 447 "displayName": "Path" 448 } 449 ] 450}