(stream: NodeJS.ReadableStream)
| 28 | } |
| 29 | |
| 30 | async function streamByteLength(stream: NodeJS.ReadableStream): Promise<number> { |
| 31 | let n = 0; |
| 32 | for await (const chunk of stream) { |
| 33 | n += (chunk as Buffer).length; |
| 34 | } |
| 35 | return n; |
| 36 | } |
| 37 | |
| 38 | // ── Tests ───────────────────────────────────────────────────────────── |
| 39 |
no outgoing calls
no test coverage detected