Get Node.js download URL and filename based on platform
()
| 39 | |
| 40 | |
| 41 | def get_node_download_info(): |
| 42 | """Get Node.js download URL and filename based on platform""" |
| 43 | system = platform.system().lower() |
| 44 | machine = platform.machine().lower() |
| 45 | |
| 46 | # Map architecture names |
| 47 | if machine in ["x86_64", "amd64"]: |
| 48 | arch = "x64" |
| 49 | elif machine in ["aarch64", "arm64"]: |
| 50 | arch = "arm64" |
| 51 | else: |
| 52 | raise ValueError(f"Unsupported architecture: {machine}") |
| 53 | |
| 54 | if system == "windows": |
| 55 | filename = f"node-v{NODE_VERSION}-win-{arch}.zip" |
| 56 | is_zip = True |
| 57 | elif system == "darwin": |
| 58 | filename = f"node-v{NODE_VERSION}-darwin-{arch}.tar.gz" |
| 59 | is_zip = False |
| 60 | elif system == "linux": |
| 61 | filename = f"node-v{NODE_VERSION}-linux-{arch}.tar.xz" |
| 62 | is_zip = False |
| 63 | else: |
| 64 | raise ValueError(f"Unsupported platform: {system}") |
| 65 | |
| 66 | url = f"https://nodejs.org/dist/v{NODE_VERSION}/{filename}" |
| 67 | return url, filename, is_zip |
| 68 | |
| 69 | |
| 70 | def download_and_extract_node(): |
no outgoing calls
no test coverage detected