Version
v22.12.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
import { Writable } from "node:stream";
const nodeWriteable = new Writable({
write(chunk, encoding, callback) {
// pending
},
highWaterMark: 5,
objectMode: false,
});
const webWritable = Writable.toWeb(nodeWriteable);
const writer = webWritable.getWriter();
writer.write(new Uint8Array(3));
console.log(nodeWriteable.writableLength, writer.desiredSize); // expect 3,2 actual 0,4
let promise = writer.write(new Uint8Array(3));
console.log(nodeWriteable.writableLength, writer.desiredSize); // expect 6, -1, actual 0,3
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
I think writer.desiredSize should be equal to highWaterMark - odeWriteable.writableLength
Otherwise, after the Writable.toWeb() conversion, the buffer queue for the writable stream is expanded
What do you see instead?
none
Additional information
No response
Version
v22.12.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
I think
writer.desiredSizeshould be equal tohighWaterMark - odeWriteable.writableLengthOtherwise, after the Writable.toWeb() conversion, the buffer queue for the writable stream is expanded
What do you see instead?
none
Additional information
No response