feat(core): add Deno.core.writeAll(rid, chunk) (#16228)

This commit adds a new op_write_all to core that allows writing an
entire chunk in a single async op call. Internally this calls
`Resource::write_all`.

The `writableStreamForRid` has been moved to `06_streams.js` now, and
uses this new op. Various other code paths now also use this new op.

Closes #16227
This commit is contained in:
Luca Casonato 2022-10-10 10:28:35 +02:00 committed by GitHub
parent 4d6aed1b52
commit 1ab3691b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 85 additions and 43 deletions

View file

@ -61,6 +61,11 @@ declare namespace Deno {
*/
function write(rid: number, buf: Uint8Array): Promise<number>;
/**
* Write to a (stream) resource that implements write()
*/
function writeAll(rid: number, buf: Uint8Array): Promise<void>;
/**
* Print a message to stdout or stderr
*/