Lightweight OS and device-type detection for browsers, Node.js, and SSR — with React hooks and Vue composables. No dependencies.

The getOS() function returns the current OS identifier: iOS, macOS, Android, Windows, Linux, ChromeOS, or unknown. Additional boolean functions (detectIsIOS, detectIsWindows, and others) let you flexibly check specific systems with no extra dependencies.
detectIsWindows11() asynchronously detects Windows 11 in the browser (via getHighEntropyValues) and in Node.js (via os.release). Returns true only for Windows 11, letting you distinguish it from Windows 10 and older without complex parsing.
isMobileDevice() and isDesktopDevice() provide quick coarse classification. The iOS detector correctly handles iPadOS 13+, which masquerades as Macintosh in the userAgent, using navigator.maxTouchPoints for accurate differentiation.
useOS() (sync) and useIsWindows11() (async with null state) are available for React and Vue. React hooks use useMemo/useState, Vue composables return readonly refs. All are SSR-safe and auto-update when the detection completes.
In Node.js, the library reads process.platform, and all functions cache the result after the first call. Cache reset is available for testing. The package has no external dependencies, ships in ESM, CJS, and UMD, with React and Vue as optional peer dependencies.