File tree 1 file changed +7
-8
lines changed
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() {
807
807
808
808
protoGetter ( 'bytesWritten' , function bytesWritten ( ) {
809
809
let bytes = this . _bytesDispatched ;
810
- const state = this . _writableState ;
811
810
const data = this . _pendingData ;
812
811
const encoding = this . _pendingEncoding ;
812
+ const writableBuffer = this . writableBuffer ;
813
813
814
- if ( ! state )
814
+ if ( ! writableBuffer )
815
815
return undefined ;
816
816
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
+ }
823
822
824
823
if ( ArrayIsArray ( data ) ) {
825
824
// Was a writev, iterate over chunks to get total length
You can’t perform that action at this time.
0 commit comments