Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore fast path: fs.isFile and fs.isDirectory #46

Open
marvinhagemeister opened this issue Jan 23, 2023 · 2 comments
Open

Explore fast path: fs.isFile and fs.isDirectory #46

marvinhagemeister opened this issue Jan 23, 2023 · 2 comments
Labels
good first issue Good for newcomers

Comments

@marvinhagemeister
Copy link
Contributor

Original issue: #39

Module resolution typically involves a lot of file system calls. During the performance meeting on 23. Jan 2023 the idea was voiced to explore how much speedup could be gained via an optimized isFile or isDirectory function.

Example npm packages where such functions are used in the wild:

@anonrig
Copy link
Member

anonrig commented Jan 23, 2023

Question: What would you expect fs.isFile to return on a non-existing path?

@marvinhagemeister
Copy link
Contributor Author

marvinhagemeister commented Jan 23, 2023

Question: What would you expect fs.isFile to return on a non-existing path?

I'd expect it to return false.

Found an isFile function in node itself that is used during ESM resolution. Looks like node would benefit from a dedicated isFile function too.

https://github.com/nodejs/node/blob/762a3a8ad925d56a12b43e0e7f7c811e93097784/lib/internal/modules/esm/resolve.js#L149-L151

@anonrig anonrig added the good first issue Good for newcomers label Jan 25, 2023
debadree25 added a commit to debadree25/node that referenced this issue Jan 25, 2023
debadree25 added a commit to debadree25/node that referenced this issue Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants