* @returns {{ platform: string, arch: string, exe: string }}
()
| 46 | * @returns {{ platform: string, arch: string, exe: string }} |
| 47 | */ |
| 48 | function platformInfo() { |
| 49 | /** @type {string} */ |
| 50 | let platform; |
| 51 | switch (process.platform) { |
| 52 | case "darwin": |
| 53 | platform = "darwin"; |
| 54 | break; |
| 55 | case "linux": |
| 56 | platform = "linux"; |
| 57 | break; |
| 58 | case "win32": |
| 59 | platform = "win32"; |
| 60 | break; |
| 61 | default: |
| 62 | throw new Error(`Unsupported platform: ${process.platform}`); |
| 63 | } |
| 64 | |
| 65 | /** @type {string} */ |
| 66 | let arch; |
| 67 | switch (process.arch) { |
| 68 | case "arm64": |
| 69 | arch = "arm64"; |
| 70 | break; |
| 71 | case "x64": |
| 72 | arch = "x64"; |
| 73 | break; |
| 74 | default: |
| 75 | throw new Error(`Unsupported architecture: ${process.arch}`); |
| 76 | } |
| 77 | |
| 78 | const exe = process.platform === "win32" ? ".exe" : ""; |
| 79 | return { platform, arch, exe }; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * @param {string} storageDir |