@@ -203,9 +203,9 @@ export default class RESP2Decoder {
203
203
this . arrayItemType = undefined ;
204
204
205
205
if ( length === - 1 ) {
206
- return this . returnArrayReply ( null , arraysToKeep ) ;
206
+ return this . returnArrayReply ( null , arraysToKeep , chunk ) ;
207
207
} else if ( length === 0 ) {
208
- return this . returnArrayReply ( [ ] , arraysToKeep ) ;
208
+ return this . returnArrayReply ( [ ] , arraysToKeep , chunk ) ;
209
209
}
210
210
211
211
this . arraysInProcess . push ( {
@@ -235,20 +235,23 @@ export default class RESP2Decoder {
235
235
}
236
236
}
237
237
238
- private returnArrayReply ( reply : ArrayReply , arraysToKeep : number ) : ArrayReply | undefined {
238
+ private returnArrayReply ( reply : ArrayReply , arraysToKeep : number , chunk ?: Buffer ) : ArrayReply | undefined {
239
239
if ( this . arraysInProcess . length <= arraysToKeep ) return reply ;
240
240
241
- return this . pushArrayItem ( reply , arraysToKeep ) ;
241
+ return this . pushArrayItem ( reply , arraysToKeep , chunk ) ;
242
242
}
243
243
244
- private pushArrayItem ( item : Reply , arraysToKeep : number ) : ArrayReply | undefined {
244
+ private pushArrayItem ( item : Reply , arraysToKeep : number , chunk ?: Buffer ) : ArrayReply | undefined {
245
245
const to = this . arraysInProcess [ this . arraysInProcess . length - 1 ] ! ;
246
246
to . array [ to . pushCounter ] = item ;
247
247
if ( ++ to . pushCounter === to . array . length ) {
248
248
return this . returnArrayReply (
249
249
this . arraysInProcess . pop ( ) ! . array ,
250
- arraysToKeep
250
+ arraysToKeep ,
251
+ chunk
251
252
) ;
253
+ } else if ( chunk && chunk . length > this . cursor ) {
254
+ return this . parseArray ( chunk , arraysToKeep ) ;
252
255
}
253
256
}
254
257
}
0 commit comments