jprichardson / node-klaw

A Node.js file system walker with a Readable stream interface. Extracted from fs-extra.
MIT License
317 stars 41 forks source link

Document that symlinks not traversed #4

Closed IgnoredAmbience closed 6 years ago

IgnoredAmbience commented 8 years ago

Spent a while trying to work out why my directory tree wasn't being traversed -- my root path was a symlink which isn't traversed. It would be helpful to document explicitly that symlinks aren't traversed, or provide an option to permit this.

jprichardson commented 8 years ago

This is an excellent point. It should allow for this. I'd accept a PR doing so.

jprichardson commented 8 years ago

PS, sorry that you had these issues :(

jprichardson commented 8 years ago

Actually, I'm not sure why you had this problem.... https://github.com/jprichardson/node-klaw/blob/9d5a5b71a8f1bd872212cff31a6281cd82378450/src/index.js#L27 It's used lstat from the beginning. Unless I'm misunderstanding the problem?

IgnoredAmbience commented 8 years ago

lstat doesn't traverse links:

lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to

Swapping lstat for stat should work, but would result in non-termination of the stream if there's any cycles in the tree.

piyush-banknovo commented 5 years ago

Symblinks are still not being traversed.

WingGao commented 5 years ago

Symblinks are still not being traversed. +1