Repository navigation
Document that fs.copyFile() dereferences symlinks #61518
Description
Activity
- addeddocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.
on Jan 25, 2026 The behavior of fs.copyFile() when handling symbolic links is currently undocumented.
While fs.cp() explicitly documents its symlink handling via the dereference option, fs.copyFile() always dereferences symlinks (i.e., it copies the contents of the target file rather than the symlink itself). This implicit behavior is not stated in the documentation, which can lead to incorrect assumptions or unexpected results for users working with symlinks.
Expected behavior
The documentation for fs.copyFile() should clearly state that it always dereferences symbolic links and does not preserve them as links.
- added 2 commits that reference this issue
on Feb 4, 2026 github-actions commented
on Jul 20, 2026 on Jul 20, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 20, 2026 Please keep this open.
- removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 21, 2026 - added a commit that references this issue
on Aug 18, 2026 - added 3 commits that reference this issue
on Aug 25, 2026 - added a commit that references this issue
on Sep 7, 2026
Affected URL(s)
https://nodejs.org/api/fs.html#fscopyfilesrc-dest-mode-callback
Description of the problem
Currently undocumented.
fs.cp()documents its symlink behavior viadereferenceoption;fs.copyFile()should note that it always dereferences.