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

Method write

lib/internal/quic/quic.js:2172–2194  ·  view source on GitHub ↗
(chunk, options = kEmptyObject)

Source from the content-addressed store, hash-verified

2170 }
2171
2172 async function write(chunk, options = kEmptyObject) {
2173 validateObject(options, 'options');
2174 const { signal } = options;
2175 if (signal !== undefined) {
2176 validateAbortSignal(signal, 'options.signal');
2177 signal.throwIfAborted();
2178 }
2179 if (errored) throw error;
2180 if (closed || stream.#inner.state.writeEnded) {
2181 throw new ERR_INVALID_STATE('Writer is closed');
2182 }
2183 // If a drain is already pending, another operation is waiting
2184 // for capacity. Under strict policy, reject immediately.
2185 // Later, if we add support for other backpressure policies,
2186 // we could instead await the existing drain before proceeding.
2187 if (drainWakeup != null) {
2188 throw new ERR_INVALID_STATE('Stream write buffer is full');
2189 }
2190
2191 if (!writeSync(chunk)) {
2192 throw new ERR_INVALID_STATE('Stream write buffer is full');
2193 }
2194 }
2195
2196 function writevSync(chunks) {
2197 if (closed || errored || stream.#inner.state.writeEnded || drainWakeup != null) {

Callers 15

_writeRawFunction · 0.45
_http_outgoing.jsFile · 0.45
convertProtocolsFunction · 0.45
zlib.jsFile · 0.45
processChunkFunction · 0.45
processCallbackFunction · 0.45
fromStringFastFunction · 0.45
createFromStringFunction · 0.45
buffer.jsFile · 0.45
constructorMethod · 0.45
finishMethod · 0.45
_handleErrorMethod · 0.45

Calls 3

validateAbortSignalFunction · 0.85
throwIfAbortedMethod · 0.80
writeSyncFunction · 0.50

Tested by

no test coverage detected