@@ -203,9 +203,9 @@ export default class RESP2Decoder {
203203 this . arrayItemType = undefined ;
204204
205205 if ( length === - 1 ) {
206- return this . returnArrayReply ( null , arraysToKeep ) ;
206+ return this . returnArrayReply ( null , arraysToKeep , chunk ) ;
207207 } else if ( length === 0 ) {
208- return this . returnArrayReply ( [ ] , arraysToKeep ) ;
208+ return this . returnArrayReply ( [ ] , arraysToKeep , chunk ) ;
209209 }
210210
211211 this . arraysInProcess . push ( {
@@ -235,20 +235,23 @@ export default class RESP2Decoder {
235235 }
236236 }
237237
238- private returnArrayReply ( reply : ArrayReply , arraysToKeep : number ) : ArrayReply | undefined {
238+ private returnArrayReply ( reply : ArrayReply , arraysToKeep : number , chunk ?: Buffer ) : ArrayReply | undefined {
239239 if ( this . arraysInProcess . length <= arraysToKeep ) return reply ;
240240
241- return this . pushArrayItem ( reply , arraysToKeep ) ;
241+ return this . pushArrayItem ( reply , arraysToKeep , chunk ) ;
242242 }
243243
244- private pushArrayItem ( item : Reply , arraysToKeep : number ) : ArrayReply | undefined {
244+ private pushArrayItem ( item : Reply , arraysToKeep : number , chunk ?: Buffer ) : ArrayReply | undefined {
245245 const to = this . arraysInProcess [ this . arraysInProcess . length - 1 ] ! ;
246246 to . array [ to . pushCounter ] = item ;
247247 if ( ++ to . pushCounter === to . array . length ) {
248248 return this . returnArrayReply (
249249 this . arraysInProcess . pop ( ) ! . array ,
250- arraysToKeep
250+ arraysToKeep ,
251+ chunk
251252 ) ;
253+ } else if ( chunk && chunk . length > this . cursor ) {
254+ return this . parseArray ( chunk , arraysToKeep ) ;
252255 }
253256 }
254257}
0 commit comments