Skip to content

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

Open

Description

@marvinhagemeister

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:

Activity

  1. anonrig commented on Jan 23, 2023

    @anonrig
    Member

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

  2. marvinhagemeister commented on Jan 23, 2023

    @marvinhagemeister
    ContributorAuthor

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions