( response: Response, )
| 20 | } |
| 21 | |
| 22 | export function getResponseStreamReader( |
| 23 | response: Response, |
| 24 | ): ReadableStreamDefaultReader<Uint8Array> { |
| 25 | if (!response.body) { |
| 26 | throw new UnsupportedResponseStreamError('Response.body') |
| 27 | } |
| 28 | |
| 29 | if (typeof response.body.getReader !== 'function') { |
| 30 | throw new UnsupportedResponseStreamError('Response.body.getReader') |
| 31 | } |
| 32 | |
| 33 | return response.body.getReader() |
| 34 | } |
| 35 | |
| 36 | export function createResponseStreamTextDecoder(): TextDecoder { |
| 37 | if (typeof globalThis.TextDecoder !== 'function') { |
no test coverage detected