property
quic.QuicStream.writer
Returns a Writer object for pushing data to the stream incrementally. The Writer implements the stream/iter Writer interface with the try-sync-fallback-to-async pattern.
Only available when no body source was provided at creation time or via stream.setBody(). Non-writable streams return an already-closed Writer. Throws ERR_INVALID_STATE if the outbound is already configured.
The Writer has the following methods:
writeSync(chunk)— Synchronous write. Returnstrueif accepted,falseif flow-controlled. Data is NOT accepted onfalse.write(chunk[, options])— Async write with drain wait.options.signalis checked at entry but not observed during the write.writevSync(chunks)— Synchronous vectored write. All-or-nothing.writev(chunks[, options])— Async vectored write.endSync()— Synchronous close. Returns total bytes or-1.end([options])— Async close.fail(reason)— Errors the stream (sendsRESET_STREAMto peer). Whenreasonis aQuicError, itserror.errorCodeis used as the wire code on the resultingRESET_STREAMframe; otherwise the wire code falls back to the negotiated application protocol's "internal error" code (H3_INTERNAL_ERROR(0x102) for HTTP/3, or the QUIC transport-layerINTERNAL_ERROR(0x1) for raw QUIC). Seestream.destroy()for a full-stream abort that also resets the readable side viaSTOP_SENDING.desiredSize— Available capacity in bytes, ornullif closed/errored.
The bytes from each writeSync() / writevSync() / write() / writev() input chunk are copied into an internal buffer, so the caller's source buffer is unchanged and may be reused or mutated immediately after the call returns. Callers that want to ensure a source buffer cannot be mutated after handing it off can call ArrayBuffer.prototype.transfer() themselves before passing the buffer.