(version)
| 36 | } |
| 37 | |
| 38 | async function getDownloadInfoForNodeVersion(version) { |
| 39 | // https://nodejs.org/download/release/v12.21.0/SHASUMS256.txt |
| 40 | const url = `${NODE_JS_BASE}/v${version}/SHASUMS256.txt` |
| 41 | const shasums = await getText(url) |
| 42 | const shasumLine = shasums.split('\n').find(line => { |
| 43 | return line.includes(`node-v${version}-darwin-x64.tar.xz`) |
| 44 | }) |
| 45 | |
| 46 | if (!shasumLine) { |
| 47 | throw new Error(`could not find matching shasum for ${version}`) |
| 48 | } |
| 49 | |
| 50 | const [shasum, filename] = shasumLine.trim().split(/\s+/) |
| 51 | return { |
| 52 | url: `${NODE_JS_BASE}/v${version}/${filename}`, |
| 53 | sha256: shasum, |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | async function calculateSHA256(fileName) { |
| 58 | const hash = crypto.createHash('sha256') |
no test coverage detected