export const MIN_COLLECTED_BODY_LENGTH = 524288 ; export class StreamChunks { chunks : String [ ] | Buffer [ ] ; length : number ; constructor ( ) { this . chunks = [ ] ; this . length = 0 ; } addChunk ( chunk ) { if ( this . length >= MIN_COLLECTED_BODY_LENGTH ) return ; const chunkLength = chunk ?. length ; if ( ! chunkLength ) return ; this . chunks . push ( chunk ) ; this . length += chunkLength ; } getBody ( ) { return this . chunks . join ( '' ) ; } }