UNPKG

@logtape/windows-eventlog

Version:

Windows Event Log sink for LogTape

30 lines (28 loc) 902 B
import { WindowsPlatformError } from "./types.js"; import process from "node:process"; //#region platform.ts /** * Validates that the current platform is Windows. * Throws a WindowsPlatformError if running on a non-Windows platform. * * @throws {WindowsPlatformError} When running on non-Windows platforms * @since 1.0.0 */ function validateWindowsPlatform() { const platform = getPlatform(); if (platform !== "windows" && platform !== "win32") throw new WindowsPlatformError(platform); } /** * Gets the current platform in a cross-runtime compatible way. * * @returns The platform identifier * @since 1.0.0 */ function getPlatform() { if (typeof Deno !== "undefined" && Deno.build?.os) return Deno.build.os; if (typeof process !== "undefined" && process.platform) return process.platform; return "unknown"; } //#endregion export { validateWindowsPlatform }; //# sourceMappingURL=platform.js.map