2024-08-23 23:58:26 +02:00
|
|
|
export type Platform =
|
2024-09-05 08:06:45 -04:00
|
|
|
| "unknown-linux-gnu"
|
|
|
|
| "unknown-linux-musl"
|
|
|
|
| "unknown-linux-musleabihf"
|
|
|
|
| "apple-darwin"
|
|
|
|
| "pc-windows-msvc";
|
|
|
|
export type Architecture = "i686" | "x86_64" | "aarch64";
|
2024-08-23 23:58:26 +02:00
|
|
|
|
|
|
|
export function getArch(): Architecture | undefined {
|
2024-09-05 08:06:45 -04:00
|
|
|
const arch = process.arch;
|
|
|
|
const archMapping: { [key: string]: Architecture } = {
|
|
|
|
ia32: "i686",
|
|
|
|
x64: "x86_64",
|
|
|
|
arm64: "aarch64",
|
|
|
|
};
|
2024-08-23 23:58:26 +02:00
|
|
|
|
|
|
|
if (arch in archMapping) {
|
2024-09-05 08:06:45 -04:00
|
|
|
return archMapping[arch];
|
2024-08-23 23:58:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getPlatform(): Platform | undefined {
|
2024-09-05 08:06:45 -04:00
|
|
|
const platform = process.platform;
|
|
|
|
const platformMapping: { [key: string]: Platform } = {
|
|
|
|
linux: "unknown-linux-gnu",
|
|
|
|
darwin: "apple-darwin",
|
|
|
|
win32: "pc-windows-msvc",
|
|
|
|
};
|
2024-08-23 23:58:26 +02:00
|
|
|
|
|
|
|
if (platform in platformMapping) {
|
2024-09-05 08:06:45 -04:00
|
|
|
return platformMapping[platform];
|
2024-08-23 23:58:26 +02:00
|
|
|
}
|
|
|
|
}
|