manidlou / node-klaw-sync

Node.js recursive synchronous fast file system walker
MIT License
157 stars 10 forks source link

Exception thrown when directory contains broken symlink. #17

Open c0d3d opened 3 years ago

c0d3d commented 3 years ago

Right now, the code uses statSync, but this attempts to read through symlinks, and will throw ENOENT for any broken symlinks.

IMO, this call should be lstatSync as it gives users more control (and also doesn't throw exceptions if the link is broken).

I found this will using a library that depends on klawSync, I wasn't aware that there was a broken symlink in the directory, but nonetheless I don't think the library should assume that users always want to read through symlinks. It would be better to let the user library break and they can deal with it accordingly.