Skip to content

platform ​

platform returns the target operating system as a native OsPlatform enum. It reflects the target this binary was compiled for, not a runtime guess.

Signatureplatform(): OsPlatform
tyrus
import { platform } from "tyrus:os";
import { OsPlatform } from "tyrus:os";

const currentPlatform: OsPlatform = platform();

if (currentPlatform === OsPlatform.Windows) {
    print("running on Windows");
}

OsPlatform Members ​

MemberMeaning
LinuxLinux
MacOSmacOS
WindowsWindows
OtherAny other target