From ef553f3714311cb349f121199977ba0a3fd0a9a9 Mon Sep 17 00:00:00 2001 From: Julian Soreavis Date: Thu, 16 Jul 2026 10:49:30 +0200 Subject: [PATCH] doc: clarify fs string paths are not parsed as URLs The String paths section does not say that a string beginning with file: is treated as a literal path rather than a file: URL, which regularly surprises users. State it explicitly and point to URL objects for file: URL support. Fixes: https://github.com/nodejs/node/issues/36585 Signed-off-by: Julian Soreavis --- doc/api/fs.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 9cb84007b3b815..ef386d18a9d21e 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -8941,6 +8941,10 @@ String paths are interpreted as UTF-8 character sequences identifying the absolute or relative filename. Relative paths will be resolved relative to the current working directory as determined by calling `process.cwd()`. +String paths are never interpreted as URLs. For example, on POSIX, +`'file:///tmp/hello'` is a relative path that begins with a directory named +`file:`. To use a `file:` URL, pass a {URL} object instead. + Example using an absolute path on POSIX: ```mjs