(readable)
| 17 | } = require('stream/iter'); |
| 18 | |
| 19 | function collect(readable) { |
| 20 | return new Promise((resolve, reject) => { |
| 21 | const chunks = []; |
| 22 | readable.on('data', (chunk) => chunks.push(chunk)); |
| 23 | readable.on('end', () => resolve(Buffer.concat(chunks))); |
| 24 | readable.on('error', reject); |
| 25 | }); |
| 26 | } |
| 27 | |
| 28 | // ============================================================================= |
| 29 | // fromStreamIter: basic async round-trip |
no test coverage detected