Skip to main content

getPlatformKey() function

Builds a unique key using the current platform and architecture.

Signature

export declare function getPlatformKey({ doForce32bit, }?: {
doForce32bit?: boolean;
}): string;

Parameters

Parameter

Type

Description

{ doForce32bit, }

{ doForce32bit?: boolean; }

(Optional)

Returns

string

The platform key in the form platform-arch.

Remarks

Generates a platform identifier string used for matching binary packages to the current system or for platform-specific configuration.

Platform key format: <platform>-<arch>

Examples:

  • darwin-x64 (macOS on Intel)
  • darwin-arm64 (macOS on Apple Silicon)
  • linux-x64 (Linux on 64-bit Intel/AMD)
  • win32-x64 (Windows on 64-bit)

Architecture coercion rules (when doForce32bit is true):

  • x64 → ia32: Coerces 64-bit Intel/AMD architecture to 32-bit on all platforms.
  • arm64 → arm: Coerces 64-bit ARM architecture to 32-bit on all platforms.

This coercion is useful for backward compatibility scenarios where only 32-bit binaries are available but can run on 64-bit systems. The platform key matches the naming conventions used in binary xPack distributions.


Generated via tsdoc2docusaurus 1.3.0-pre by API Extractor/Documenter 7.55.2.