| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 94528f5 commit fcb211f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -805,19 +805,18 @@ protoGetter('_bytesDispatched', function _bytesDispatched() { | |||
| 805 | 805 | ||
| 806 | 806 | protoGetter('bytesWritten', function bytesWritten() { | |
| 807 | 807 | let bytes = this._bytesDispatched; | |
| 808 | - const state = this._writableState; | ||
| 809 | 808 | const data = this._pendingData; | |
| 810 | 809 | const encoding = this._pendingEncoding; | |
| 810 | + const writableBuffer = this.writableBuffer; | ||
| 811 | 811 | ||
| 812 | - if (!state) | ||
| 812 | + if (!writableBuffer) | ||
| 813 | 813 | return undefined; | |
| 814 | 814 | ||
| 815 | - this.writableBuffer.forEach(function(el) { | ||
| 816 | - if (el.chunk instanceof Buffer) | ||
| 817 | - bytes += el.chunk.length; | ||
| 818 | - else | ||
| 819 | - bytes += Buffer.byteLength(el.chunk, el.encoding); | ||
| 820 | - }); | ||
| 815 | + for (const el of writableBuffer) { | ||
| 816 | + bytes += el.chunk instanceof Buffer ? | ||
| 817 | + el.chunk.length : | ||
| 818 | + Buffer.byteLength(el.chunk, el.encoding); | ||
| 819 | + } | ||
| 821 | 820 | ||
| 822 | 821 | if (ArrayIsArray(data)) { | |
| 823 | 822 | // Was a writev, iterate over chunks to get total length | |
| Back | FazBrowse Home | New Git URL |
0 commit comments