@@ -2266,6 +2266,72 @@ The following body source types are supported:
22662266Throws ` ERR_INVALID_STATE ` if the outbound is already configured or if
22672267the writer has been accessed.
22682268
2269+ ### ` stream.resetStream([code]) `
2270+
2271+ <!-- YAML
2272+ added: REPLACEME
2273+ -->
2274+
2275+ * ` code ` {number|bigint} The application error code to include in the
2276+ ` RESET_STREAM ` frame sent to the peer. Numbers are coerced to ` BigInt ` .
2277+ ** Default:** ` 0n ` .
2278+
2279+ Sends a ` RESET_STREAM ` frame to the peer, signalling that this end will
2280+ not send any more data on this stream. This half-closes the stream in the
2281+ WRITE direction only — the readable side (if any) is unaffected and can
2282+ continue receiving data from the peer.
2283+
2284+ If the stream has already been destroyed, this is a no-op.
2285+
2286+ This is useful for WebTransport and other application protocols that need
2287+ independent half-closing per direction without tearing down the entire
2288+ stream.
2289+
2290+ ``` mjs
2291+ import { connect } from ' node:quic' ;
2292+
2293+ const session = await connect (' localhost:4567' , { alpn: ' myproto' });
2294+ const stream = await session .createBidirectionalStream ();
2295+
2296+ // Abort the writable side with application error code 42.
2297+ stream .resetStream (42n );
2298+ ```
2299+
2300+ See [ Aborting a stream] [ ] for an overview of all stream-abort APIs.
2301+
2302+ ### ` stream.stopSending([code]) `
2303+
2304+ <!-- YAML
2305+ added: REPLACEME
2306+ -->
2307+
2308+ * ` code ` {number|bigint} The application error code to include in the
2309+ ` STOP_SENDING ` frame sent to the peer. Numbers are coerced to ` BigInt ` .
2310+ ** Default:** ` 0n ` .
2311+
2312+ Sends a ` STOP_SENDING ` frame to the peer, requesting that the peer stop
2313+ sending data on this stream. This half-closes the stream in the READ
2314+ direction only — the writable side (if any) is unaffected and can
2315+ continue sending data to the peer.
2316+
2317+ If the stream has already been destroyed, this is a no-op.
2318+
2319+ This is useful for WebTransport and other application protocols that need
2320+ independent half-closing per direction without tearing down the entire
2321+ stream.
2322+
2323+ ``` mjs
2324+ import { connect } from ' node:quic' ;
2325+
2326+ const session = await connect (' localhost:4567' , { alpn: ' myproto' });
2327+ const stream = await session .createBidirectionalStream ();
2328+
2329+ // Tell the peer to stop sending with application error code 7.
2330+ stream .stopSending (7n );
2331+ ```
2332+
2333+ See [ Aborting a stream] [ ] for an overview of all stream-abort APIs.
2334+
22692335### ` stream.session `
22702336
22712337<!-- YAML
@@ -4447,6 +4513,8 @@ throughput issues caused by flow control.
44474513[`sessionOptions.sni`]: #sessionoptionssni-server-only
44484514[`sessionOptions.token`]: #sessionoptionstoken-client-only
44494515[`stream.destroy()`]: #streamdestroyerror-options
4516+ [`stream.resetStream()`]: #streamresetstreamcode
4517+ [`stream.stopSending()`]: #streamstopsendingcode
44504518[`stream.headers`]: #streamheaders
44514519[`stream.onerror`]: #streamonerror
44524520[`stream.onwanttrailers`]: #streamonwanttrailers
0 commit comments