-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs.realpath vs fs.realpath.native differences not documented #45067
Comments
Hey, this is really good. Do you think you can send a PR documenting this? BTW, thanks again for the report |
@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? |
I would extend the scope and put some references to the necessary errors. |
PR-URL: #48170 Fixes: #45067 Reviewed-By: James M Snell <[email protected]>
PR-URL: #48170 Fixes: #45067 Reviewed-By: James M Snell <[email protected]>
PR-URL: #48170 Fixes: #45067 Reviewed-By: James M Snell <[email protected]>
PR-URL: #48170 Fixes: #45067 Reviewed-By: James M Snell <[email protected]>
PR-URL: #48170 Fixes: #45067 Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#48170 Fixes: nodejs#45067 Reviewed-By: James M Snell <[email protected]>
PR-URL: nodejs#48170 Fixes: nodejs#45067 Reviewed-By: James M Snell <[email protected]>
Affected URL(s)
https://nodejs.org/api/fs.html#fsrealpathpath-options-callback
Description of the problem
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.
Example:
If this is intentional it should be documented.
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.
The text was updated successfully, but these errors were encountered: