Skip to content
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

doc: clarify symlink resolution for __filename #24587

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,8 @@ added: v0.0.1

* {string}

The file name of the current module. This is the resolved absolute path of the
current module file.
The file name of the current module. This is current module file's absolute path
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an idea, but I think file could be omitted or moved before path, which might be even clearer?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So either current module's absolute path or else current module's absolute file path? It's subtle, but I wonder if that might make someone expect __dirname value instead of __filename if a module is loaded or invoked at the directory level (e.g., node . instead of node index.js).

with symlinks resolved.

For a main program this is not necessarily the same as the file name used in the
command line.
Expand Down