| 130 | assert(stream[kState].controller instanceof ReadableByteStreamController); |
| 131 | |
| 132 | async function read(stream) { |
| 133 | const reader = stream.getReader({ mode: 'byob' }); |
| 134 | |
| 135 | const chunks = []; |
| 136 | let result; |
| 137 | do { |
| 138 | result = await reader.read(Buffer.alloc(100)); |
| 139 | if (result.value !== undefined) |
| 140 | chunks.push(Buffer.from(result.value)); |
| 141 | } while (!result.done); |
| 142 | |
| 143 | return Buffer.concat(chunks); |
| 144 | } |
| 145 | |
| 146 | read(stream).then(common.mustCall((data) => { |
| 147 | const check = readFileSync(__filename); |