-
Notifications
You must be signed in to change notification settings - Fork 632
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
What's happening with writeAll
and writeAllSync
?
#6284
Comments
We consider Web Streams (ReadableStream and WritableStream) as the main way of I/O in Deno denoland/deno#11288 denoland/deno#9795
The recommended way for writing things to stdout is something like: await dataSource.pipeTo(Deno.stdout.writable, { preventClose: true }); |
@kt3k That only works for async scenarios, though. For context, I was revisiting an old StackOverflow answer of mine and I realized it wasn't correct, so I updated it with what I think (?) are the best/simplest ways of doing this as of end-of-2024. But neither of them are completely trivial; the sync version uses |
Maybe we can consider making
I agree with this. The current behavior doesn't seem useful/ergonomic. Can you create an issue for it in Deno CLI repo? I currently don't have any idea about how to improve the async version. Any suggestions are welcome. |
Context:
Deno.writeAll
andDeno.writeAllSync
were deprecated and then removed.writeAll
andwriteAllSync
of@std/streams
were deprecated, moved to@std/io
, and then removed.@std/io
#5003,@std/io
is no longer due for stabilization in order to "to nudge people to use@std/streams
instead".Deno.stdout.write
andDeno.stdout.writeSync
both warn that "It is not guaranteed that the full buffer will be written in a single call" (as do the corresponding methods ofDeno.stderr
).In light of all that, what if anything is the stabilization path for a high-level "write all this stuff to stdout/stderr (with no newline at the end) and definitely don't bail part-way through" method in Deno/std?
Conversely, is there any reason for that method not to simply be
Deno.std(out|err).write(Sync)?
? I'm struggling to think of any low-level use case where it'd be preferable to bail part-way through in an unspecified way (as opposed to, say, relying on userland code to chunk/paginate the input as appropriate).The text was updated successfully, but these errors were encountered: