Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yeliex/node.os
OS detect for both nodejs and browser
https://github.com/yeliex/node.os
Last synced: about 2 months ago
JSON representation
OS detect for both nodejs and browser
- Host: GitHub
- URL: https://github.com/yeliex/node.os
- Owner: yeliex
- License: mit
- Created: 2016-04-07T07:11:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-22T05:58:46.000Z (over 6 years ago)
- Last Synced: 2024-04-24T19:22:41.531Z (8 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node.os
[![npm](https://img.shields.io/npm/v/node.os.svg?style=flat-square)](https://www.npmjs.com/package/node.os)
OS detect for both nodejs and browser
## Installation
```
$ npm install node.os
```## Use with node
```js
const os = require("node.os"); // return os objectconsole.log(os.os); // win,osx,linx,etc
console.log(os.platform); // the same as require("os").platform()
````## Use with Browser
```js
const os = require("node.os"); // return os objectconsole.log(os.os); // win,osx,linux,ios,android,etc
console.log(os.platform); // browser/nw(node webkit)
````## Use with html
```htmlconsole.log(window.os)
```
## Other Params:
```js
- isWin
- isOSX
- isLinux
- isIOS
- isAndroid
- isBrowser // return 'true' when platform is 'browser' or 'nw' or 'Electron' or 'wechat'
- isOnlyBrowser // return 'true' only when platform is 'browser'
- isNW
- isWechat
- isElectron
````