From 213c9e2b59856923dd1f4d99ac2505f7c3364688 Mon Sep 17 00:00:00 2001 From: developers-universe-1 Date: Thu, 28 May 2026 16:28:35 -0400 Subject: [PATCH] doc: document that fs.copyFile() always dereferences symlinks Add a note to fs.copyFile(), fs.copyFileSync(), and fsPromises.copyFile() documenting that they always dereference symlinks, matching the behavior already documented for fs.cp(). Fixes: https://github.com/nodejs/node/issues/61518 --- doc/api/fs.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/api/fs.md b/doc/api/fs.md index 350555f2f8ad99..2a38e5b9774fa4 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1277,6 +1277,8 @@ No guarantees are made about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, an attempt will be made to remove the destination. +`fsPromises.copyFile()` always dereferences symlinks. + ```mjs import { copyFile, constants } from 'node:fs/promises'; @@ -2754,6 +2756,8 @@ callback function. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination. +`fs.copyFile()` always dereferences symlinks. + `mode` is an optional integer that specifies the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. @@ -5857,6 +5861,8 @@ already exists. Returns `undefined`. Node.js makes no guarantees about the atomicity of the copy operation. If an error occurs after the destination file has been opened for writing, Node.js will attempt to remove the destination. +`fs.copyFileSync()` always dereferences symlinks. + `mode` is an optional integer that specifies the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g.