in src/setup-node/src.main.kts [59:77]
fun installNode(version: String, installationPath: File, os: OS, arch: Arch) {
val nodeVersionManager = NodeJsVersionManager(version, os, arch)
val downloadInfo = nodeVersionManager.getDownloadInfo()
val unpackPath = File(installationPath, downloadInfo.filename)
val binPath = getBinPath(unpackPath)
if (binPath.isDirectory && binPath.listFiles()?.isNotEmpty() == true) {
println("NodeJs ${downloadInfo.version} is already installed to ${unpackPath.absolutePath}")
} else {
println("Downloading NodeJs from ${downloadInfo.downloadUrl}")
val archivePath = downloadToTemp(downloadInfo)
println("Downloaded to ${archivePath.absolutePath}")
Unpack.unpackFile(archivePath, installationPath)
println("Unpacked to ${unpackPath.absolutePath}")
}
addToPath(binPath.absolutePath)
}