MCPcopy
hub / github.com/PokemonGoF/PokemonGo-Bot / onEofChunk

Function onEofChunk

map-chat/javascript/browserMqtt.js:3194–3210  ·  view source on GitHub ↗
(stream, state)

Source from the content-addressed store, hash-verified

3192
3193
3194function 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

Callers 1

readableAddChunkFunction · 0.85

Calls 2

emitReadableFunction · 0.85
endReadableFunction · 0.85

Tested by

no test coverage detected