Skip to content

Commit 6479897

Browse files
committed
correction
1 parent 0b784b4 commit 6479897

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

doc/api/url.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));
925925

926926
When working with `file:///` URLs in Node.js (eg when working with ES modules
927927
which are keyed in the registry by File URL), the utility functions
928-
`urlToFilePath` and `fileURLToPath` are provided to convert to and from file
928+
`pathToFileURL` and `fileURLToPath` are provided to convert to and from file
929929
paths.
930930

931931
The edge cases handled by these functions include percent-encoding and decoding
@@ -942,10 +942,10 @@ new URL(__filename);
942942
new URL('./foo#1', 'file:///');
943943

944944
// 'file:///nas/foo.txt' instead of the correct 'file:///foo.txt' (posix)
945-
new URL('file://' + '//nas/foo.txt');
945+
new URL(`file://${'//nas/foo.txt'}`);
946946

947947
// 'file:///some/path%' instead of the correct 'file:///some/path%25' (posix)
948-
new URL('file:' + '/some/path%.js');
948+
new URL(`sfile:${'/some/path%.js'}`);
949949
```
950950

951951
where using `pathToFileURL` we can get the correct results above.

0 commit comments

Comments
 (0)