Skip to content

hostname ​

hostname returns the machine's network hostname.

Signaturehostname(): string
tyrus
import { hostname } from "tyrus:os";

const name: string = hostname();
print(`running on ${name}`);

Never fails the program

Falls back to "unknown" if the operating system does not report a hostname, rather than aborting the program.