Skip to content

fs.readdir(path, { recursive: true }) is sync #56006

Description

@RafaelGSS

Reviving #51749.

The implementation in #41439 is calling a synchronous approach even for an asynchronous call. See https://github.com/nodejs/node/blob/main/lib/fs.js#L1458.

I will take a quick look at that and see if I can fix it; otherwise, we might want to consider documenting it explicitly until we have a real solution for it.

cc: @Ethan-Arrowood

Activity

  1. added
    confirmed-bugIssues and PRs for confirmed bugs.
    fsIssues and PRs related to file-system APIs and the fs module.
    on Nov 26, 2024
  2. aduh95 commented on Nov 26, 2024

    @aduh95
    Contributor

    We could mark it as legacy and decide to not fix the issue, as long as the promise version is correctly async we can probably get away with the callback version being wrongly sync.

  3. RafaelGSS commented on Nov 27, 2024

    @RafaelGSS
    MemberAuthor

    We could mark it as legacy and decide to not fix the issue, as long as the promise version is correctly async we can probably get away with the callback version being wrongly sync.

    If a sync version has a feature and its callback equivalent call doesn't... looks like a bad UX to me. Have we considered a new function instead? It seems more appropriate: fs.recursiveReaddir()

  4. RafaelGSS commented on Nov 27, 2024

    @RafaelGSS
    MemberAuthor

    Nevermind, I have a PR almost ready to fix this.

  5. added a commit that references this issue on Nov 27, 2024
  6. added a commit that references this issue on Dec 5, 2024
  7. added a commit that references this issue on Dec 6, 2024
  8. added a commit that references this issue on Jan 5, 2025
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

    confirmed-bugIssues and PRs for confirmed bugs.fsIssues and PRs related to file-system APIs and the fs module.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions