File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -486,6 +486,7 @@ export class JsonStreamStringify extends Readable {
486
486
readMore = false ;
487
487
readState : ReadState = ReadState . NotReading ;
488
488
async _read ( size ?: number ) {
489
+ if ( this . readState === ReadState . Consumed ) return ;
489
490
if ( this . readState !== ReadState . NotReading ) {
490
491
this . readState = ReadState . ReadMore ;
491
492
return ;
@@ -502,7 +503,7 @@ export class JsonStreamStringify extends Readable {
502
503
if ( this . buffer . length ) this . push ( this . buffer ) ;
503
504
this . push ( null ) ;
504
505
this . readState = ReadState . Consumed ;
505
- this . _destroy ( ) ;
506
+ this . cleanup ( ) ;
506
507
}
507
508
if ( this . readState === < any > ReadState . ReadMore ) {
508
509
this . readState = ReadState . NotReading ;
@@ -511,18 +512,18 @@ export class JsonStreamStringify extends Readable {
511
512
this . readState = ReadState . NotReading ;
512
513
}
513
514
514
- _destroy ( ) {
515
- this . destroyed = true ;
515
+ private cleanup ( ) {
516
516
this . buffer = undefined ;
517
517
this . visited = undefined ;
518
518
this . item = undefined ;
519
+ this . root = undefined ;
519
520
this . prePush = undefined ;
520
521
}
521
522
522
523
destroy ( error ?: Error ) : this {
523
524
if ( error ) this . emit ( 'error' , error ) ;
524
525
super . destroy ?.( ) ;
525
- this . _destroy ( ) ;
526
+ this . cleanup ( ) ;
526
527
return this ;
527
528
}
528
529
}
You can’t perform that action at this time.
0 commit comments