* WARNING! Can be used with text content only. Binary data (e.g. images) will get broken! * * @param {ReadableStream} stream * @returns {Promise }
(stream)
| 11 | * @returns {Promise<string>} |
| 12 | */ |
| 13 | async function readFromStream(stream) { |
| 14 | let result = ''; |
| 15 | for await (const chunk of stream) { |
| 16 | result += chunk; |
| 17 | } |
| 18 | return result; |
| 19 | } |
| 20 | |
| 21 | function readStream(stream) { |
| 22 | return new Promise((resolve, reject) => { |
no outgoing calls
no test coverage detected