(url, dest)
| 69 | } |
| 70 | |
| 71 | export function downloadFile(url, dest) { |
| 72 | try { |
| 73 | const result = spawnSync('curl', ['-fL', '-sS', '-o', dest, url], { |
| 74 | stdio: 'pipe', |
| 75 | encoding: 'utf-8', |
| 76 | }); |
| 77 | if (result.status !== 0) { |
| 78 | throw new Error(result.stderr); |
| 79 | } |
| 80 | return dest; |
| 81 | } catch (e) { |
| 82 | console.error(`Failed to download file from ${url}`); |
| 83 | throw e; |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | export function findFile(startPath, filter) { |
| 88 | if (!fs.existsSync(startPath)) { |
no test coverage detected