MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / getDownloadInfoForNodeVersion

Function getDownloadInfoForNodeVersion

release/scripts/homebrew.js:38–55  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

36}
37
38async 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
57async function calculateSHA256(fileName) {
58 const hash = crypto.createHash('sha256')

Callers 1

updateCgNodeFormulaFunction · 0.85

Calls 1

getTextFunction · 0.85

Tested by

no test coverage detected