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

Method endSync

lib/internal/quic/quic.js:2237–2255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2235 }
2236
2237 function endSync() {
2238 // Per the streams/iter spec, endSync and end follow a try-fallback
2239 // pattern. That is, callers should try endSync first and if it returns
2240 // -1, then they should call and await end(). This is a signal that sync
2241 // end is not currently possible. However, we always support sync end
2242 // here unless the stream is already errored.
2243 if (errored) return -1;
2244
2245 // If we're already closed, just return the total bytes written.
2246 if (closed) return totalBytesWritten;
2247
2248 // If we are waiting for drain to complete, we cannot end synchronously.
2249 if (drainWakeup != null) return -1;
2250
2251 // Fantastic, we can end synchronously!
2252 handle.endWrite();
2253 closed = true;
2254 return totalBytesWritten;
2255 }
2256
2257 async function end(options = kEmptyObject) {
2258 validateObject(options, 'options');

Calls

no outgoing calls

Tested by

no test coverage detected