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

Method getReader

lib/internal/webstreams/readablestream.js:363–377  ·  view source on GitHub ↗

* @param {{ * mode? : "byob" * }} [options] * @returns {ReadableStreamReader}

(options = kEmptyObject)

Source from the content-addressed store, hash-verified

361 * @returns {ReadableStreamReader}
362 */
363 getReader(options = kEmptyObject) {
364 if (!isReadableStream(this))
365 throw new ERR_INVALID_THIS('ReadableStream');
366 validateObject(options, 'options', kValidateObjectAllowObjectsAndNull);
367 const mode = options?.mode;
368
369 if (mode === undefined)
370 // eslint-disable-next-line no-use-before-define
371 return new ReadableStreamDefaultReader(this);
372
373 if (`${mode}` !== 'byob')
374 throw new ERR_INVALID_ARG_VALUE('options.mode', mode);
375 // eslint-disable-next-line no-use-before-define
376 return new ReadableStreamBYOBReader(this);
377 }
378
379 /**
380 * @param {ReadableWritablePair} transform

Callers 15

mainFunction · 0.95
mainFunction · 0.95
setupTestStreamFunction · 0.95
streamMethod · 0.80
arrayBufferFunction · 0.80
[SymbolAsyncIterator]Method · 0.80
compose.jsFile · 0.80
runWebStreamFunction · 0.80

Calls 1

isReadableStreamFunction · 0.50

Tested by 2

testFunction · 0.64
testFunction · 0.64