(n, state)
| 637 | // This function is designed to be inlinable, so please take care when making |
| 638 | // changes to the function body. |
| 639 | function howMuchToRead(n, state) { |
| 640 | if (n <= 0 || (state.length === 0 && (state[kState] & kEnded) !== 0)) |
| 641 | return 0; |
| 642 | if ((state[kState] & kObjectMode) !== 0) |
| 643 | return 1; |
| 644 | if (NumberIsNaN(n)) { |
| 645 | // Fast path for buffers. |
| 646 | if ((state[kState] & kDecoder) === 0 && state.length) |
| 647 | return state.buffer[state.bufferIndex].length; |
| 648 | |
| 649 | // Only flow one buffer at a time. |
| 650 | if ((state[kState] & kFlowing) !== 0 && state.length) |
| 651 | return state.buffer[state.bufferIndex].length; |
| 652 | |
| 653 | return state.length; |
| 654 | } |
| 655 | if (n <= state.length) |
| 656 | return n; |
| 657 | return (state[kState] & kEnded) !== 0 ? state.length : 0; |
| 658 | } |
| 659 | |
| 660 | // You can override either this method, or the async _read(n) below. |
| 661 | Readable.prototype.read = function(n) { |
no outgoing calls
no test coverage detected
searching dependent graphs…