(url)
| 149 | } |
| 150 | |
| 151 | async function fetchRelease(url) { |
| 152 | if (proxyEnvSet()) { |
| 153 | // Dynamic require so it works in node without bundling issues |
| 154 | const undici = require('undici') |
| 155 | return await undici.fetch(url, { |
| 156 | redirect: 'follow', |
| 157 | dispatcher: new undici.EnvHttpProxyAgent(), |
| 158 | }) |
| 159 | } |
| 160 | // Node 18+ has global fetch, Bun has it too |
| 161 | return await fetch(url, { redirect: 'follow' }) |
| 162 | } |
| 163 | |
| 164 | async function downloadUrlToBuffer(url) { |
| 165 | const response = await fetchRelease(url) |
no test coverage detected