You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs.realpath vs fs.realpath.native differences not documented #45067
There is a difference in the errors thrown by fs.realpath and fs.realpath.native, when the path does not exist, fs.realpath throws an error with the path property set to the realpath stopping at the first subpath that does not exist, while the fs.realpath.native throws an error with the path property set to the value of the path argument.
This is particularly annoying because fsPromises.realpath runs fs.realpath.native and therefore a coder that would switch from fs.realpath to fsPromises.realpath would expect consistent behaviour and even if the documentation states the fsPrommises uses .native, it does not show the different behaviour highlighted above.
Activity
juanarbol commentedon Oct 26, 2022
Hey, this is really good. Do you think you can send a PR documenting this? BTW, thanks again for the report
didiercolens commentedon Oct 26, 2022
@juanarbol thank you, I need some guidance because errors are documented in https://github.com/nodejs/node/blob/main/doc/api/errors.md#class-systemerror and this behaviour is specific to 2 fs methods. Should I add a comment in fs.realpath describing the error.path property in case of ENOENT error?
juanarbol commentedon Oct 26, 2022
I would extend the scope and put some references to the necessary errors.
doc: update `fs.realpath` documentation
doc: update `fs.realpath` documentation
doc: update `fs.realpath` documentation