租房小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.4 KiB

3 months ago
  1. # os-name [![Build Status](https://travis-ci.org/sindresorhus/os-name.svg?branch=master)](https://travis-ci.org/sindresorhus/os-name)
  2. > Get the name of the current operating system. Example: `OS X Mavericks`
  3. Useful for analytics and debugging.
  4. ## Install
  5. ```sh
  6. $ npm install --save os-name
  7. ```
  8. ## Usage
  9. ```js
  10. var os = require('os');
  11. var osName = require('os-name');
  12. // on an OS X Mavericks system
  13. osName();
  14. //=> OS X Mavericks
  15. osName(os.platform(), os.release());
  16. //=> OS X Mavericks
  17. osName(os.platform());
  18. //=> OS X
  19. osName('linux', '3.13.0-24-generic');
  20. //=> Linux 3.13
  21. osName('win32', '6.3.9600');
  22. //=> Windows 8.1
  23. osName('win32');
  24. // Windows
  25. ```
  26. ## API
  27. ### osName([platform, release])
  28. By default the name of the current operating system is returned.
  29. You can optionally supply a custom [`os.platform()`](http://nodejs.org/api/os.html#os_os_platform) and [`os.release()`](http://nodejs.org/api/os.html#os_os_release).
  30. Check out [getos](https://github.com/wblankenship/getos) if you need the Linux distribution name.
  31. ## CLI
  32. ```sh
  33. $ npm install --global os-name
  34. ```
  35. ```sh
  36. $ os-name --help
  37. Example
  38. os-name
  39. OS X Mavericks
  40. ```
  41. ## Contributing
  42. Production systems depend on this package for logging / tracking. Please be careful when introducing new output, and adhere to existing output format (whitespace, capitalization, etc.).
  43. ## License
  44. MIT © [Sindre Sorhus](http://sindresorhus.com)