Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#1067·node-fs-extra

Question about copy logic

Author: RyanZimCreated Apr 20, 2026Updated Sep 2, 2026
Labelsquestionfeature-copy

@manidlou Looking at the code, I'm not sure I understand the meaning of the comment here:

https://github.com/jprichardson/node-fs-extra/blob/353a29b18c883fa0f3997fd8be90a89077633af4/lib/copy/copy-sync.js#L143-L146

Is the intent that if dest exists, but can't be read, we call fs.symlinkSync in order to trigger an EEXIST error here? Assumption being that if we can't read it, we can't unlink it either?

Basically, I'm trying to make sure that it's intentional that we're just symlinking without unlinking first in this case here. LMK if there's anything I can clarify.

The same comment & logic exists in copy() as well: https://github.com/jprichardson/node-fs-extra/blob/353a29b18c883fa0f3997fd8be90a89077633af4/lib/copy/copy.js#L150-L153

Source: jprichardson/node-fs-extra

View original on GitHubView discussion on GitHub