thecodrr / fdir

⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
https://thecodrr.github.io/fdir/
MIT License
1.51k stars 58 forks source link

feat: add `withSymlinks` argument back #104

Closed SuperchupuDev closed 2 months ago

SuperchupuDev commented 3 months ago

While working on tinyglobby I've noticed there is no way to disable fdir returning the real path of a symlink anymore, due to #81 silently removing support for it (even though the documentation still mentions the feature!).

This PR adds it back, inside an object parameter instead for better API design (see https://github.com/thecodrr/fdir/issues/83#issuecomment-1282787956). It defaults to true for backwards compatibility

Closes #103

SuperchupuDev commented 3 months ago

hi @thecodrr, any chance you can take a look at this anytime soon? symlinks wont quite work in my library until this (or an equivalent solution) is merged

thecodrr commented 3 months ago

Relevant commit: https://github.com/thecodrr/fdir/commit/cdb201f4f2c3afdf05f46e42894a8ef5836568a0

SuperchupuDev commented 3 months ago

yes, that commit is what this PR aims to implement, but #81 removed the withSymlinks parameter that commit introduced. i can rename this pr to make that clearer

SuperchupuDev commented 3 months ago

changing it to lstat makes this test fail as it makes it return non-resolved symlinks image

SuperchupuDev commented 3 months ago

@thecodrr i've reverted the lstat change, it makes behavior the same as if not using withSymlinks at all for some reason. not to worry though as it seems to work as intended with stat

SuperchupuDev commented 2 months ago

@thecodrr is there anything blocking the PR?