Socket
Socket
Sign inDemoInstall

detect-os

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    detect-os

Detect current running OS including version and codename.


Version published
Weekly downloads
160
decreased by-21.95%
Maintainers
1
Install size
32.5 kB
Created
Weekly downloads
 

Readme

Source

Detect OS in Javascript

CI JavaScript Style Guide Project Status: Active – The project has reached a stable, usable state and is being actively developed. GitHub

Detect current running OS including version and arch, if possible. No dependencies. All code < 300 lines.

This is just a minimal, simple and incomplete package to detect the following:

  • os - Android, Windows, OSX, Linux etc. or undefined for unknown
  • isMobile - true if a mobile OS, otherwise false
  • name - For example "Ubuntu" when OS is "Linux" or undefined
  • arch - 32, 64 or undefined
  • ram - if navigator.deviceMemory is available or undefined

Uses mainly navigator.platform and navigator.userAgent as second guess for detection.

No legacy support yet, no support for OS-minorites yet. Feel free to contribute!

Why not use feature detection instead?

Yes we all know this is the better option. However, this package intends to detect the OS and not the browser, so feature detection won't help that much.

There are more distinct ways of detecting the OS based on certain ways of feature implementation and results but that won't be covered by this package (yet).

License

MIT, see license

FAQs

Last updated on 23 May 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc