Skip to content

Commit

Permalink
correction
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Aug 24, 2018
1 parent 0b784b4 commit 6479897
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));

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

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

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

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

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

0 comments on commit 6479897

Please sign in to comment.