Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.

Use fs.statSync? #2

Closed
joliss opened this issue Sep 12, 2015 · 4 comments
Closed

Use fs.statSync? #2

joliss opened this issue Sep 12, 2015 · 4 comments

Comments

@joliss
Copy link

joliss commented Sep 12, 2015

Currently, fs.existsSync is implemented in terms of fs.statSync. I think this module can copy that logic and be much simpler as a result.

statSync already follows symlinks automatically and throws an ENOENT error on broken symlinks, unlike lstatSync, so no special handling is needed for that.

@trabus
Copy link
Contributor

trabus commented Sep 12, 2015

@joliss I'm absolutely open to doing that, I don't know why I didn't realize stat followed symlinks.

I'll try and find some time to refactor this weekend.

@stefanpenner
Copy link
Contributor

Thanks guys

@trabus
Copy link
Contributor

trabus commented Sep 13, 2015

@joliss I tried swapping in statSync instead of lstatSync, but I'm unable to get it working with my tests. :(
It refuses to follow the symlinks I've setup in my tests, and throws ENOENT errors on symlinks that worked with lstatSync. Maybe I'm doing something wrong with my setup?

@nathanhammond
Copy link
Contributor

fs.existsSync has been un-deprecated. Any further changes to this should only address known bugs. In light of that I'm closing this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants