Files
node/lib
Abhinandan Kumar b6db21972a fs: preserve directory timestamps in cp
This fixes an issue where fs.cp and fs.cpSync (when a filter is
provided) correctly restore mtime and atime on copied files when
preserveTimestamps: true is passed, but skip restoring them for
directories.

The fix applies the existing setDestTimestamps helper to directories,
ensuring it is called after directory creation/copying but before any
modes are restored (since restoring a read-only mode would prevent
timestamp modification).

Note: This fix covers fs.cp() (async, all cases) and fs.cpSync()
when a filter is provided. The native fast path used by cpSync()
without a filter (CpSyncCopyDir in src/node_file.cc) has the
identical gap and is left for a separate follow-up contribution, since
it requires native code changes and a different review path.

Signed-off-by: Abhinandan Kumar <abhi128618@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65540
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
2026-09-15 10:49:20 +02:00
..
…
…
…
2026-07-06 10:03:33 +02:00
…
2026-08-26 00:55:35 +02:00
2026-09-15 10:49:17 +02:00
2026-09-15 10:49:06 +02:00
2026-08-26 00:56:02 +02:00
…
2025-12-10 16:12:28 +00:00
2025-12-22 16:14:46 +00:00
2026-08-26 00:56:01 +02:00
2025-09-04 11:58:50 +00:00
2026-02-21 16:30:23 +00:00
2026-05-05 16:19:15 +02:00
2026-08-26 00:56:21 +02:00
2026-05-05 16:19:39 +02:00
2026-06-20 17:50:48 +02:00