Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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 object

console.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 object

console.log(os.os); // win,osx,linux,ios,android,etc
console.log(os.platform); // browser/nw(node webkit)
````

## Use with html
```html

console.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
````