Writable.toWeb() used a plain { highWaterMark } as the queuing
strategy for non-object-mode streams, which meant no size function
was provided. The WritableStream defaulted to counting each chunk
as size 1, so desiredSize was incorrect (e.g., a 3-byte Uint8Array
was counted as size 1 instead of 3).
Add a size() function to the strategy that mirrors how the Node.js
stream computes chunk length: byteLength for typed arrays, length
for strings/buffers, falling back to 1.
Fixes: https://github.com/nodejs/node/issues/56269
Signed-off-by: Matteo Collina <hello@matteocollina.com>
PR-URL: https://github.com/nodejs/node/pull/62986
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
|
||
|---|---|---|
| .. | ||
| adapters.js | ||
| compression.js | ||
| encoding.js | ||
| queuingstrategies.js | ||
| readablestream.js | ||
| transfer.js | ||
| transformstream.js | ||
| util.js | ||
| writablestream.js | ||