(stream, state)
| 3192 | |
| 3193 | |
| 3194 | function onEofChunk(stream, state) { |
| 3195 | if (state.decoder && !state.ended) { |
| 3196 | var chunk = state.decoder.end(); |
| 3197 | if (chunk && chunk.length) { |
| 3198 | state.buffer.push(chunk); |
| 3199 | state.length += state.objectMode ? 1 : chunk.length; |
| 3200 | } |
| 3201 | } |
| 3202 | state.ended = true; |
| 3203 | |
| 3204 | // if we've ended and we have some data left, then emit |
| 3205 | // 'readable' now to make sure it gets picked up. |
| 3206 | if (state.length > 0) |
| 3207 | emitReadable(stream); |
| 3208 | else |
| 3209 | endReadable(stream); |
| 3210 | } |
| 3211 | |
| 3212 | // Don't emit readable right away in sync mode, because this can trigger |
| 3213 | // another read() call => stack overflow. This way, it might trigger |
no test coverage detected