# get-os-name

> Get the operating system name of a client with JavaScript and the Navigator Web API

Latest version **1.0.3** (published 2023-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-os-name
pnpm add get-os-name
yarn add get-os-name
bun add get-os-name
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2023-01-03 |
| First published | 2022-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | xulw |
| Maintainers | xulw |
| Keywords | javascript, js, operating, system, os, name, navigator, api, browser, web, client, windows, macos, linux, unix, ios, android, detect, find, info, title |

## Links

- npm: https://www.npmjs.com/package/get-os-name
- Repository: https://github.com/xulww/get-os-name
- Homepage: https://github.com/xulww/get-os-name#readme
- Issues: https://github.com/xulww/get-os-name/issues
- npm.io page: https://npm.io/package/get-os-name

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.0.3 (latest) — 2023-01-03
- 1.0.2 — 2022-12-20
- 1.0.1 — 2022-12-20
- 1.0.0 — 2022-12-20

## README

# get-os-name
This is a very simple and small npm package that gives you the operating system name of a client. It has **no dependencies** and uses JavaScript and the 
Navigator Web API, which has [wide browser support](https://caniuse.com/mdn-api_navigator).

## Installation
```
npm install get-os-name
```

## Important
To be more specific, this package uses [navigator.userAgent](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/userAgent). Keep in mind that browser users can change 
the value of this field if they want (UA spoofing).

## Exports
| Function name               | Return type | Description                                                                                                                         |
| --------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------- |
| getOperatingSystemName      | string      | The default package export. A function that returns the name of the operating system (e.g. "Windows"). Fallbacks to "Unknown".      |
| isUNIX                      | boolean     | A function that returns true if the operating system is UNIX                                                                        |
| isWindows                   | boolean     | A function that returns true if the operating system is Windows                                                                     |
| isMacOS                     | boolean     | A function that returns true if the operating system is macOS                                                                       |
| isLinux                     | boolean     | A function that returns true if the operating system is Linux                                                                       |
| isAndroid                   | boolean     | A function that returns true if the operating system is Android                                                                     |
| isIOS                       | boolean     | A function that returns true if the operating system is iOS                                                                         |


## Usage
```javascript
import getOperatingSystemName, {
  isUNIX,
  isWindows,
  isMacOS,
  isLinux,
  isAndroid,
  isIOS,
} from "get-os-name";

const osName = getOperatingSystemName()
const isOSNameUNIX = isUNIX()
const isOSNameWindows = isWindows()
const isOSNameMacOS = isMacOS()
const isOSNameLinux = isLinux()
const isOSNameAndroid = isAndroid()
const isOSNameIOS = isIOS()
```
[Demo](https://codesandbox.io/s/get-os-name-example-6ccr13)

---
_Source: https://npm.io/package/get-os-name · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
