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

Function isClosed

lib/internal/streams/utils.js:235–259  ·  view source on GitHub ↗
(stream)

Source from the content-addressed store, hash-verified

233}
234
235function isClosed(stream) {
236 if (!isNodeStream(stream)) {
237 return null;
238 }
239
240 if (typeof stream.closed === 'boolean') {
241 return stream.closed;
242 }
243
244 const wState = stream._writableState;
245 const rState = stream._readableState;
246
247 if (
248 typeof wState?.closed === 'boolean' ||
249 typeof rState?.closed === 'boolean'
250 ) {
251 return wState?.closed || rState?.closed;
252 }
253
254 if (typeof stream._closed === 'boolean' && isOutgoingMessage(stream)) {
255 return stream._closed;
256 }
257
258 return null;
259}
260
261function isOutgoingMessage(stream) {
262 return (

Callers 1

eosFunction · 0.70

Calls 2

isNodeStreamFunction · 0.85
isOutgoingMessageFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…