(reader, successSteps, failureSteps)
| 5764 | } |
| 5765 | __name(readableStreamClose, "readableStreamClose"); |
| 5766 | async function readAllBytes(reader, successSteps, failureSteps) { |
| 5767 | try { |
| 5768 | const bytes = []; |
| 5769 | let byteLength = 0; |
| 5770 | do { |
| 5771 | const { done, value: chunk } = await reader.read(); |
| 5772 | if (done) { |
| 5773 | successSteps(Buffer.concat(bytes, byteLength)); |
| 5774 | return; |
| 5775 | } |
| 5776 | if (!isUint8Array(chunk)) { |
| 5777 | failureSteps(new TypeError("Received non-Uint8Array chunk")); |
| 5778 | return; |
| 5779 | } |
| 5780 | bytes.push(chunk); |
| 5781 | byteLength += chunk.length; |
| 5782 | } while (true); |
| 5783 | } catch (e) { |
| 5784 | failureSteps(e); |
| 5785 | } |
| 5786 | } |
| 5787 | __name(readAllBytes, "readAllBytes"); |
| 5788 | function urlIsLocal(url) { |
| 5789 | assert("protocol" in url); |
no test coverage detected