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

Function consumeStart

deps/undici/src/lib/api/readable.js:429–461  ·  view source on GitHub ↗

* @param {Consume} consume * @returns {void}

(consume)

Source from the content-addressed store, hash-verified

427 * @returns {void}
428 */
429function consumeStart (consume) {
430 if (consume.body === null) {
431 return
432 }
433
434 const { _readableState: state } = consume.stream
435
436 if (state.bufferIndex) {
437 const start = state.bufferIndex
438 const end = state.buffer.length
439 for (let n = start; n < end; n++) {
440 consumePush(consume, state.buffer[n])
441 }
442 } else {
443 for (const chunk of state.buffer) {
444 consumePush(consume, chunk)
445 }
446 }
447
448 if (state.endEmitted) {
449 consumeEnd(this[kConsume], this._readableState.encoding)
450 } else {
451 consume.stream.on('end', function () {
452 consumeEnd(this[kConsume], this._readableState.encoding)
453 })
454 }
455
456 consume.stream.resume()
457
458 while (consume.stream.read() != null) {
459 // Loop
460 }
461}
462
463/**
464 * @param {Buffer[]} chunks

Callers 1

consumeFunction · 0.70

Calls 5

consumePushFunction · 0.70
consumeEndFunction · 0.70
resumeMethod · 0.65
onMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…