Skip to content

fs: add support for async iterators to fs.writeFile #38075

Description

@yagipy

After this lands, does it make sense to add this to the regular fs version as well (not just fs/promises)?
#37490 (comment)

I'm curious too, so I made it an issue.
If necessary, I would like to handle it.

Activity

  1. changed the title [-]fs: writeFile support AsyncIterable, Iterable & Stream as data argument (regular fs version)[/-] [+]fs: add support for async iterators to `fs.writeFile`[/+] on Apr 4, 2021
  2. aduh95 commented on Apr 4, 2021

    @aduh95
    Contributor

    If #37948 lands, I think we shouldn't add features to the callback API.
    And even if it doesn't land, I would advice to focus on other part of the codebase that needs improvement: users who want to use async iterators with a callback API can use util.callbackify. That being said, I wouldn't block if a PR was sent with an implementation, I just don't think it's necessary.

  3. added
    fsIssues and PRs related to file-system APIs and the fs module.
    questionIssues asking questions about Node.js.
    on Apr 4, 2021
  4. benjamingr commented on Apr 4, 2021

    @benjamingr
    Member

    I would be +1 and would be happy to help you collaborate on this regardless of the callback APIs status of legacy yes/no.

    It would probably make sense for consistency IMO.

  5. jimmywarting commented on Apr 13, 2021

    @jimmywarting

    if the async iterator is able to write plain uint8array instead of relying on the buffer, then yes +1

  6. benjamingr commented on Apr 13, 2021

    @benjamingr
    Member

    @jimmywarting are there any FS APIs that require Buffers and don't take "regular" Uint8Arrays?

  7. jimmywarting commented on Apr 13, 2021

    @jimmywarting

    @benjamingr Hmm, maybe in the old days, things might have changed for the better now :)

    remember that i could write a uint8array cuz it wasn't a buffer - this seems to no longer be the case

  8. github-actions commented on Jun 27, 2026

    @github-actions
    Contributor

    This issue has been marked as stale due to 210 days of inactivity.
    It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

  9. added
    staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.
    on Jun 27, 2026
  10. github-actions commented on Jul 28, 2026

    @github-actions
    Contributor

    This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
    If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.

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

    fsIssues and PRs related to file-system APIs and the fs module.questionIssues asking questions about Node.js.staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions