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

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

Open
yagipy opened this issue Apr 4, 2021 · 5 comments · May be fixed by yagipy/node#5 or #38525
Open

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

yagipy opened this issue Apr 4, 2021 · 5 comments · May be fixed by yagipy/node#5 or #38525
Labels
fs Issues and PRs related to the fs subsystem / file system. question Issues that look for answers.

Comments

@yagipy
Copy link
Contributor

yagipy commented Apr 4, 2021

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.

@yagipy yagipy changed the title fs: writeFile support AsyncIterable, Iterable & Stream as data argument (regular fs version) fs: add support for async iterators to fs.writeFile Apr 4, 2021
@aduh95
Copy link
Contributor

aduh95 commented Apr 4, 2021

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.

@aduh95 aduh95 added fs Issues and PRs related to the fs subsystem / file system. question Issues that look for answers. labels Apr 4, 2021
@benjamingr
Copy link
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.

@jimmywarting
Copy link

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

@benjamingr
Copy link
Member

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

@jimmywarting
Copy link

jimmywarting commented Apr 13, 2021

@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

yagipy pushed a commit to yagipy/node that referenced this issue May 3, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 3, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 3, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 4, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 8, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 8, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 8, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 8, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 8, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 8, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 9, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 9, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 9, 2021
yagipy pushed a commit to yagipy/node that referenced this issue May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. question Issues that look for answers.
Projects
None yet
4 participants