(url, dest)
| 121 | } |
| 122 | |
| 123 | function tryPowerShellDownload(url, dest) { |
| 124 | const u = url.replace(/'/g, "''") |
| 125 | const d = dest.replace(/'/g, "''") |
| 126 | const cmd = `Invoke-WebRequest -Uri '${u}' -OutFile '${d}' -UseBasicParsing` |
| 127 | const result = spawnSync( |
| 128 | 'powershell.exe', |
| 129 | [ |
| 130 | '-NoProfile', |
| 131 | '-NonInteractive', |
| 132 | '-ExecutionPolicy', |
| 133 | 'Bypass', |
| 134 | '-Command', |
| 135 | cmd, |
| 136 | ], |
| 137 | { stdio: 'pipe', windowsHide: true }, |
| 138 | ) |
| 139 | return result.status === 0 && existsSync(dest) && statSync(dest).size > 0 |
| 140 | } |
| 141 | |
| 142 | function tryCurlDownload(url, dest) { |
| 143 | const curl = process.platform === 'win32' ? 'curl.exe' : 'curl' |
no test coverage detected