File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -807,19 +807,18 @@ protoGetter('_bytesDispatched', function _bytesDispatched() {
807807
808808protoGetter ( 'bytesWritten' , function bytesWritten ( ) {
809809 let bytes = this . _bytesDispatched ;
810- const state = this . _writableState ;
811810 const data = this . _pendingData ;
812811 const encoding = this . _pendingEncoding ;
812+ const writableBuffer = this . writableBuffer ;
813813
814- if ( ! state )
814+ if ( ! writableBuffer )
815815 return undefined ;
816816
817- this . writableBuffer . forEach ( function ( el ) {
818- if ( el . chunk instanceof Buffer )
819- bytes += el . chunk . length ;
820- else
821- bytes += Buffer . byteLength ( el . chunk , el . encoding ) ;
822- } ) ;
817+ for ( const el of writableBuffer ) {
818+ bytes += el . chunk instanceof Buffer ?
819+ el . chunk . length :
820+ Buffer . byteLength ( el . chunk , el . encoding ) ;
821+ }
823822
824823 if ( ArrayIsArray ( data ) ) {
825824 // Was a writev, iterate over chunks to get total length
You can’t perform that action at this time.
0 commit comments