MCPcopy Index your code
hub / github.com/nodejs/node / setBody

Method setBody

lib/internal/quic/quic.js:2375–2394  ·  view source on GitHub ↗

* Sets the outbound body source for this stream. Accepts all body * source types (string, TypedArray, Blob, AsyncIterable, Promise, null). * Can only be called once. Mutually exclusive with stream.writer. * @param {any} body

(body)

Source from the content-addressed store, hash-verified

2373 * @param {any} body
2374 */
2375 setBody(body) {
2376 assertIsQuicStream(this);
2377 if (this.destroyed) {
2378 throw new ERR_INVALID_STATE('Stream is destroyed');
2379 }
2380 const inner = this.#inner;
2381 if (inner.outboundSet) {
2382 throw new ERR_INVALID_STATE('Stream outbound already configured');
2383 }
2384 if (inner.writer !== undefined) {
2385 throw new ERR_INVALID_STATE('Stream writer already accessed');
2386 }
2387 inner.outboundSet = true;
2388 // If the body is a FileHandle, store it so it is closed
2389 // automatically when the stream finishes.
2390 if (FileHandle.isFileHandle(body)) {
2391 inner.fileHandle = body;
2392 }
2393 configureOutbound(this.#handle, this, body);
2394 }
2395
2396 /**
2397 * Associates a FileHandle with this stream so it is closed automatically

Calls 2

configureOutboundFunction · 0.85
isFileHandleMethod · 0.80

Tested by

no test coverage detected