mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
doc: add note about path.basename on Windows
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
0a2610a7aa
commit
93e4d545d8
1 file changed
+13
@@ -87,6 +87,19 @@ path.basename('/foo/bar/baz/asdf/quux.html', '.html');
|
||||
// Returns: 'quux'
|
||||
```
|
||||
|
||||
Although Windows usually treats file names, including file extensions, in a
|
||||
case-insensitive manner, this function does not. For example, `C:\\foo.html` and
|
||||
`C:\\foo.HTML` refer to the same file, but `basename` treats the extension as a
|
||||
case-sensitive string:
|
||||
|
||||
```js
|
||||
path.win32.basename('C:\\foo.html', '.html');
|
||||
// Returns: 'foo'
|
||||
|
||||
path.win32.basename('C:\\foo.HTML', '.html');
|
||||
// Returns: 'foo.HTML'
|
||||
```
|
||||
|
||||
A [`TypeError`][] is thrown if `path` is not a string or if `ext` is given
|
||||
and is not a string.
|
||||
|
||||
|
||||
Reference in new issue
Block a user