Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 93e4d54

Browse filesBrowse files
tniessenruyadorno
authored andcommitted
doc: add note about path.basename on Windows
PR-URL: #35065 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 0a2610a commit 93e4d54
Copy full SHA for 93e4d54

File tree

Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-0
lines changed
Open diff view settings
Collapse file

‎doc/api/path.md‎

Copy file name to clipboardExpand all lines: doc/api/path.md
+13Lines changed: 13 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ path.basename('/foo/bar/baz/asdf/quux.html', '.html');
8787
// Returns: 'quux'
8888
```
8989

90+
Although Windows usually treats file names, including file extensions, in a
91+
case-insensitive manner, this function does not. For example, `C:\\foo.html` and
92+
`C:\\foo.HTML` refer to the same file, but `basename` treats the extension as a
93+
case-sensitive string:
94+
95+
```js
96+
path.win32.basename('C:\\foo.html', '.html');
97+
// Returns: 'foo'
98+
99+
path.win32.basename('C:\\foo.HTML', '.html');
100+
// Returns: 'foo.HTML'
101+
```
102+
90103
A [`TypeError`][] is thrown if `path` is not a string or if `ext` is given
91104
and is not a string.
92105

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.